//查找引用了哪些资源 private static void FindSelfReferences(string assetPath) { /* * Dictionary<string, string[]> tempRefDic = new Dictionary<string,string[]>(); * if(Directory.Exists(assetPath)) * { * string dstAssetPath = FindReferences.GetRelativeAssetsPath(assetPath); * tempRefDic = Finddependent.FindAllFolderDependent(assetPath,dstAssetPath); * } * else * { * string[] a = Finddependent.GetAssetDependencies(assetPath); * tempRefDic.Add(assetPath,a); * } * foreach(var keyvalue in tempRefDic) * { * Debug.Log("==================" + keyvalue.Key + "===================="); * foreach (var fileName in keyvalue.Value) * { * Debug.Log("==================" + fileName + "===================="); * } * }*/ if (Directory.Exists(assetPath)) { Finddependent.FindFolderDependentByArtToolsWindow(assetPath); } else { Finddependent.FindAssetDependentByArtToolsWindow(assetPath); } }
//可视化使用 public static void FindFolderDependentByArtToolsWindow(string path) { string dstAssetPath = FindReferences.GetRelativeAssetsPath(path); refDic = FindAllFolderDependent(path, dstAssetPath); Finddependent window = (Finddependent)EditorWindow.GetWindow(typeof(Finddependent)); window.Show(); }
//可视化使用 public static void FindAssetDependentByArtToolsWindow(string path) { if (string.IsNullOrEmpty(path)) { EditorUtility.DisplayDialog("查找依赖", "请选中你要查找的资源", "确定"); return; } string[] a = GetAssetDependencies(path); if (a == null) { EditorUtility.DisplayDialog("查找依赖", "你要查找的资源不存在", "确定"); return; } refDic.Clear(); refDic.Add(path, a); Finddependent window = (Finddependent)EditorWindow.GetWindow(typeof(Finddependent)); window.Show(); }