最近把项目升级到Unity2018.3.5f1最新版了(我的胆子大吧,从Unity5.6.6升级的),里面的IGSoft_Resource这个插件肯定是用不了了,毕竟是2015就停更的插件。Unity商店也下架了。在升级的过程中为了不去管那么多麻烦错误什么的,直接把这个插件删了。最终导致部分预设,尤其是特效(美术跟程序毕竟不一样,术业有专攻嘛)挂在了这个插件里面的一些脚本什么的。好像有一百多个。所以就写了个脚本删除这些丢失脚本的小工具。有相似距离的可以试试。
[MenuItem("Prefab Tool/删除文件夹中预设脚本丢失的Component(慎用)")]
static void RmoveMissingScript()
{
string[] strs = Selection.assetGUIDs;
if (strs.Length <= 0)
{
EditorUtility.DisplayDialog("WTF", "请选择要检查的目录!", "?");
return;
}
foreach(string str in strs)
{
string path = AssetDatabase.GUIDToAssetPath(str);
Debug.Log(path);
List<string> assets = new List<string>();
GetAllFile(Application.dataPath.Replace("/Assets", "/") + path, ref assets);
string assetPath = string.Empty;
AssetImporter tmpAssetImport;
GameObject tmpPrefab;
Component[] tmpComponents;