mirror of https://github.com/tuyoogame/YooAsset
Update EditorTools.cs
修复Assets目录下存在多个YooAsset同名文件夹时,工具窗口无法显示的问题。 修复通过Packages导入YooAsset,工具窗口无法显示的问题。pull/4/head
parent
25088918d3
commit
0d7c93ac55
|
@ -430,26 +430,40 @@ namespace YooAsset.Editor
|
||||||
if (string.IsNullOrEmpty(YooAssetPath) == false)
|
if (string.IsNullOrEmpty(YooAssetPath) == false)
|
||||||
return YooAssetPath;
|
return YooAssetPath;
|
||||||
|
|
||||||
string packagesPath = ("Packages/com.tuyoo.yooasset/README.md");
|
// 从Pakcages目录下搜索
|
||||||
|
string packagesPath = ("Packages/com.tuyoogame.yooasset/README.md");
|
||||||
var obj = AssetDatabase.LoadAssetAtPath(packagesPath, typeof(TextAsset));
|
var obj = AssetDatabase.LoadAssetAtPath(packagesPath, typeof(TextAsset));
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
{
|
{
|
||||||
YooAssetPath = "Packages/com.tuyoo.yooasset/";
|
YooAssetPath = "Packages/com.tuyoogame.yooasset/";
|
||||||
return YooAssetPath;
|
return YooAssetPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 从Assets目录下搜索
|
||||||
string[] allDirectorys = Directory.GetDirectories(Application.dataPath, "YooAsset", SearchOption.AllDirectories);
|
string[] allDirectorys = Directory.GetDirectories(Application.dataPath, "YooAsset", SearchOption.AllDirectories);
|
||||||
if (allDirectorys.Length == 0)
|
if (allDirectorys.Length == 0)
|
||||||
{
|
{
|
||||||
Debug.LogError("Not found YooAsset Folder!");
|
Debug.LogError("Not found YooAsset Package !");
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
if (allDirectorys.Length > 1)
|
|
||||||
|
string targetDirectory = string.Empty;
|
||||||
|
foreach (var directory in allDirectorys)
|
||||||
{
|
{
|
||||||
Debug.LogError("Found multiple YooAsset Folders!");
|
string asmdefFilePath = $"{directory}/Editor/YooAsset.Editor.asmdef";
|
||||||
|
if (File.Exists(asmdefFilePath))
|
||||||
|
{
|
||||||
|
targetDirectory = directory;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(targetDirectory))
|
||||||
|
{
|
||||||
|
Debug.LogError("Should never get here !");
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
YooAssetPath = AbsolutePathToAssetPath(allDirectorys[0]);
|
|
||||||
|
YooAssetPath = AbsolutePathToAssetPath(targetDirectory);
|
||||||
return YooAssetPath;
|
return YooAssetPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue