zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/Editor/CalEditor/DeleteAllAssetBundlesEditor.cs

36 lines
1006 B
C#

using System;
using System.Collections.Generic;
using System.IO;
using ET;
using ET;
using UnityEditor;
using UnityEngine;
namespace ETEditor
{
public class DeleteAllAssetBundlesEditor: EditorWindow
{
[MenuItem("Tools/Del All assetbundle")]
private static void DelAllAssetBundles()
{
//UnityEngine.Object[] obj = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets);
string[] strs = Selection.assetGUIDs;
string path = AssetDatabase.GUIDToAssetPath(strs[0]);
path = Path.Combine(Application.dataPath.Replace("Assets",""), path);
DirectoryInfo info = new DirectoryInfo(path);
int count = 0;
foreach (FileInfo item in info.GetFiles("*",SearchOption.AllDirectories))
{
if(item.FullName.EndsWith(".assetbundle") || item.FullName.EndsWith(".assetbundle.meta"))
{
count++;
File.Delete(item.FullName);
}
}
Log.Info($"删除了{count}个");
}
}
}