mirror of https://github.com/tuyoogame/YooAsset
Update EditorTools.cs
parent
857eb1d0bb
commit
6bd48845d2
|
@ -7,7 +7,6 @@ using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Animations;
|
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
|
@ -413,6 +412,8 @@ namespace YooAsset.Editor
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 路径
|
#region 路径
|
||||||
|
private static string YooAssetPath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取规范的路径
|
/// 获取规范的路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -421,6 +422,37 @@ namespace YooAsset.Editor
|
||||||
return path.Replace('\\', '/').Replace("\\", "/"); //替换为Linux路径格式
|
return path.Replace('\\', '/').Replace("\\", "/"); //替换为Linux路径格式
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取资源框架目录路径
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooAssetPath()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(YooAssetPath) == false)
|
||||||
|
return YooAssetPath;
|
||||||
|
|
||||||
|
string packagesPath = ("Packages/com.tuyoo.yooasset/README.md");
|
||||||
|
var obj = AssetDatabase.LoadAssetAtPath(packagesPath, typeof(TextAsset));
|
||||||
|
if(obj != null)
|
||||||
|
{
|
||||||
|
YooAssetPath = "Packages/com.tuyoo.yooasset/";
|
||||||
|
return YooAssetPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] allDirectorys = Directory.GetDirectories(Application.dataPath, "YooAsset", SearchOption.AllDirectories);
|
||||||
|
if (allDirectorys.Length == 0)
|
||||||
|
{
|
||||||
|
Debug.LogError("Not found YooAsset Folder!");
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
if (allDirectorys.Length > 1)
|
||||||
|
{
|
||||||
|
Debug.LogError("Found multiple YooAsset Folders!");
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
YooAssetPath = AbsolutePathToAssetPath(allDirectorys[0]);
|
||||||
|
return YooAssetPath;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取项目工程路径
|
/// 获取项目工程路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue