using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
public class Test
{
[MenuItem("BuildTool/Lugs")]
static void LugsTest()
{
string assetpath = "Assets/UI/Prefab/ui_login/ui_login.prefab";
string[] a = GetAssetDependencies(assetpath);
for (int i = 0, iMax = a.Length; i < iMax; ++i)
{
Debug.Log(a[i]);
}
}
static string[] GetAssetDependencies(string assetPath)
{
if (!File.Exists(assetPath))
return null;
string[] dependecies = AssetDatabase.GetDependencies(assetPath);
return dependecies;
}
}
执行结果: