public static Dictionary <string, string> CollectReferenceImagePathsFor(ColorSpace colorSpace, RuntimePlatform runtimePlatform, GraphicsDeviceType graphicsApi) { var result = new Dictionary <string, string>(); if (!Directory.Exists(ReferenceImagesRoot)) { return(result); } var fullPathPrefix = string.Format("{0}/{1}/{2}/{3}/", ReferenceImagesRoot, colorSpace, runtimePlatform, graphicsApi); foreach (var assetPath in AssetDatabase.GetAllAssetPaths() .Where(p => p.StartsWith(ReferenceImagesRoot, StringComparison.OrdinalIgnoreCase)) .Where(p => fullPathPrefix.StartsWith(Path.GetDirectoryName(p))) .OrderBy(p => p.Count(ch => ch == '/'))) { // Skip directories if (!File.Exists(assetPath)) { continue; } var fileName = Path.GetFileNameWithoutExtension(assetPath); if (fileName == null) { continue; } var texture = AssetDatabase.LoadAssetAtPath <Texture2D>(assetPath); if (!texture) { continue; } result[fileName] = assetPath; } return(result); }
static HashSet <string> FindReferences(Object obj) { var path = AssetDatabase.GetAssetPath(obj); var selfAndParents = ExtractSelfAndParents(path); var pathAsDir = path; bool isDir = Directory.Exists("./" + path); if (isDir) { pathAsDir += "/"; } var referencedBy = new HashSet <string>(); var assets = AssetDatabase.GetAllAssetPaths().Where(file => !file.StartsWith(pathAsDir) && file != path).ToArray(); var total = assets.Length; var invTotal = 1f / total; var count = 0; var totalString = " / " + total; foreach (var asset in assets) { count++; if (count % 20 == 0 && EditorUtility.DisplayCancelableProgressBar("Find Reference(s)", "Looking for reference(s) " + count + totalString, (count * invTotal))) { break; } var dependencies = AssetDatabase.GetDependencies(new string[] { asset }); Func <string, bool> referenceSelfParentOrChildren = (dep) => ((selfAndParents.Contains(dep) && dep != asset) || (isDir && dep.StartsWith(pathAsDir))); if (dependencies.FirstOrDefault(referenceSelfParentOrChildren) != null) { referencedBy.Add(asset); } } referencedBy.UnionWith(LibraryReferences(obj)); return(referencedBy); }
private IEnumerable <DependencyViewerOperation> FindReferencesAmongAssets(DependencyViewerNode node) { string[] excludeFilters = _settings.ExcludeAssetFilters.Split(','); var allLocalAssetPaths = from assetPath in AssetDatabase.GetAllAssetPaths() where assetPath.StartsWith("Assets/") && !IsAssetPathExcluded(assetPath, ref excludeFilters) select assetPath; AssetDependencyResolverOperation operationStatus = new AssetDependencyResolverOperation { node = node, numTotalAssets = allLocalAssetPaths.Count() }; foreach (string assetPath in allLocalAssetPaths) { ++operationStatus.numProcessedAssets; UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(assetPath); if (obj != null) { bool isPrefab = (obj is GameObject); if (isPrefab) { GameObject prefab = obj as GameObject; foreach (var op in FindReferencesAmongPrefabChildren(node, prefab, operationStatus, prefab)) { yield return(op); } } else { foreach (var op in FindReferencesOnUnityObject(node, obj, operationStatus)) { yield return(op); } } } } }
//Read and create preview of prefabs void UpdatePreviewPrefabs() { string[] assetsPaths = AssetDatabase.GetAllAssetPaths(); string foldertoCheck = PrefabFolder.Remove(0, PrefabFolder.IndexOf("Asset")); List <GUIContent> guicontent = new List <GUIContent>(); Texture2D previewTmp; //tmp UnityEngine.Object obj; //see directory,, and get all prefabs for (int i = 0; i < assetsPaths.Length; i++) { if (assetsPaths[i].StartsWith(foldertoCheck)) { if (assetsPaths[i] != foldertoCheck) { #if UNITY_5_0 obj = AssetDatabase.LoadAssetAtPath((string)assetsPaths[i], typeof(GameObject)); #else obj = AssetDatabase.LoadAssetAtPath((string)assetsPaths[i], typeof(GameObject)); #endif if (obj != null) //check if is a prefab { //PrefabPreview_holder.Add(AssetPreview.GetAssetPreview(obj)); previewTmp = AssetPreview.GetAssetPreview(obj); //guicontent.Add(new GUIContent(PrefabPreview_holder[PrefabPreview_holder.Count - 1], obj.name)); guicontent.Add(new GUIContent(previewTmp, obj.name)); Prefabs.Add((GameObject)obj); } } } } //add to preview in gui PrefabPreview = guicontent.ToArray(); indexPrefab = 0; }
public virtual void ReverseRefResCheck(Object[] selection) { List <Object> objects = GetAllRefCheckObjectFromInput(selection, "t:Object"); if (objects == null || objects.Count == 0 || string.IsNullOrEmpty(postfix)) { return; } //加入全部查找列表 checkModule.AddObjectToSideBarList(objects); //获取当前所有后缀为当前checker的资源路径 string[] checkAssetPath = AssetDatabase.GetAllAssetPaths().Where(x => x.EndsWith(postfix)).ToArray(); for (int i = 0; i < checkAssetPath.Length; i++) { if (EditorUtility.DisplayCancelableProgressBar("正在反向检查位于" + checkerFilter + "类型资源引用", "已完成:" + i + "/" + checkAssetPath.Length, (float)i / checkAssetPath.Length)) { break; } string assetPath = checkAssetPath[i]; if (string.IsNullOrEmpty(assetPath)) { continue; } string[] depends = AssetDatabase.GetDependencies(assetPath); foreach (var depend in depends) { foreach (var obj in objects) { string tempPath = AssetDatabase.GetAssetPath(obj); //排除自身 if (tempPath == depend && tempPath != assetPath) { //与正常的查询反过来,foundinreference是被查找的资源,前面的是引用被查找资源的资源 AddObjectDetail(AssetDatabase.LoadAssetAtPath <Object>(assetPath), obj, null); } } } } EditorUtility.ClearProgressBar(); }
static void TryResolveEditorData(GiraffeAtlas atlas) { // atlas._sourceResolved: // 0 - no attempt // 1 - attempt, and found // 2 - attemped, and not found switch (atlas._importDataResolved) { case 0: case 2: { foreach (var n in AssetDatabase.GetAllAssetPaths()) { if (n.StartsWith("Assets/") == false) { continue; } if (n.EndsWith(".asset") == false) { continue; } UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(n, typeof(GiraffeImportData)); if (obj != null && obj is GiraffeImportData) { GiraffeImportData source = obj as GiraffeImportData; if (source.atlasIdA == atlas.atlasIdA && source.atlasIdB == atlas.atlasIdB) { atlas._importData = source; atlas._importDataResolved = 1; source._atlas = atlas; source._atlasResolved = 1; return; } } } atlas._importDataResolved = 2; } break; } }
/// <summary> /// Assign the sprites from the folder to existing sprite layers. /// </summary> public static void AssignSpritesFromFolder(Layout layout) { layout.ResetSpriteLayers(); string folder = AssetDatabase.GetAssetPath(layout.imageSourceAssetFolder); List <string> assetPaths = new List <string>(AssetDatabase.GetAllAssetPaths()); assetPaths.RemoveAll(each => !each.StartsWith(folder)); // with each document layer foreach (Layer layer in layout.document.allLayers) { UnitySpriteLayer spriteLayer = layout.FindSpriteLayer(layer); spriteLayer.ResetSprites(); // with each matching asset path foreach (string assetPath in assetPaths) { // extra the filename string onlyFilename = Path.GetFileNameWithoutExtension(assetPath); // and go through each guess at the layer's sprite name foreach (string guess in layer.GetGuessesForSpriteName()) { // match? if (onlyFilename == guess) { spriteLayer.sprite = (Sprite)AssetDatabase.LoadAssetAtPath(assetPath, typeof(Sprite)); spriteLayer.name = onlyFilename; spriteLayer.bounds = spriteLayer.sprite.bounds; spriteLayer.spriteLayerStyle = SpriteLayerStyle.UnitySprite; break; } } } } // reset the labels layout.ResetHierarchyLabels(); }
/// <summary> /// Build the ASSEMBLY_NAME.dll from the project's scripts using MSBuild. /// </summary> void CompileAssemblyWithMSBuild() { Debug.Log("Compiling scripts with MSBuild..."); IEnumerable <string> scriptAssetPaths = AssetDatabase.GetAllAssetPaths().Where(assetPath => assetPath.EndsWith(".cs") && IsIncludedAssetPath(assetPath)); if (scriptAssetPaths.Count() == 0) { Debug.LogFormat("No scripts found to compile."); return; } if (!File.Exists(MSBUILD_PATH)) { throw new Exception("MSBUILD_PATH not set to your MSBuild.exe"); } //modify the csproj (if needed) var csproj = File.ReadAllText("ktanemodkit.CSharp.csproj"); csproj = csproj.Replace("<AssemblyName>Assembly-CSharp</AssemblyName>", "<AssemblyName>" + assemblyName + "</AssemblyName>"); File.WriteAllText("modkithelper.CSharp.csproj", csproj); string path = "modkithelper.CSharp.csproj"; System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = MSBUILD_PATH; p.StartInfo.Arguments = path + " /p:Configuration=Release"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = false; p.StartInfo.RedirectStandardError = false; p.StartInfo.CreateNoWindow = true; p.Start(); p.WaitForExit(); string source = string.Format("Temp/UnityVS_bin/Release/{0}.dll", assemblyName); string dest = Path.Combine(outputFolder, assemblyName + ".dll"); File.Copy(source, dest); }
public string AllAssetSize() { int size = 0; string[] pathes = AssetDatabase.GetAllAssetPaths(); foreach (string s in pathes) { if (!File.Exists(s)) { continue; } var fileInfo = new FileInfo(s); if (fileInfo != null) { var fileSize = fileInfo.Length; size += (int)fileSize; } } var ws = GetFormatSizeString(size, 1024, "#,##0.##"); return(ws); }
private bool CheckAsmdef() { var assetPath = AssetDatabase.GetAssetPath(target); var assetFolder = Path.GetDirectoryName(assetPath); if (assetFolder == null) { return(true); } _assetFolder = assetFolder.Replace("\\", "/"); var regex = new Regex($"^{_assetFolder}.*\\.asmdef$"); foreach (var path in AssetDatabase.GetAllAssetPaths()) { if (regex.IsMatch(path)) { return(true); } } return(false); }
public static bool TryFindScript(Type type, out MonoScript script) { _ = type ?? throw new ArgumentNullException(nameof(type)); foreach (var path in AssetDatabase.GetAllAssetPaths()) { if (AssetDatabase.GetMainAssetTypeAtPath(path) == typeof(MonoScript)) { var monoScript = AssetDatabase.LoadAssetAtPath <MonoScript>(path); var classType = monoScript.GetClass(); if (monoScript.GetClass() == type) { script = monoScript; return(true); } } } script = null; return(false); }
/// <summary> /// Finds an existing resource reference for the specified asset. /// </summary> /// <param name="assetGuid"> /// The guid of the asset. /// </param> public static ResourceReference FindReference(string assetGuid) { string path = null; ResourceReference reference = null; if (reference == null) { path = AssetDatabase.GUIDToAssetPath(assetGuid); path = Path.ChangeExtension(path, string.Format("{0}.{1}", assetGuid, Path.GetExtension(path))); reference = AssetDatabase.LoadAssetAtPath(path, typeof(ResourceReference)) as ResourceReference; reference = (reference != null && reference.Guid == assetGuid) ? reference : null; } if (reference == null) { path = AssetDatabase.GetAllAssetPaths().FirstOrDefault(p => p.Contains(assetGuid)); reference = AssetDatabase.LoadAssetAtPath(path, typeof(ResourceReference)) as ResourceReference; reference = (reference != null && reference.Guid == assetGuid) ? reference : null; } return(reference); }
private void LoadAllAtlases() { if (atlases == null) { atlases = new List <UGUIAtlas> (); } else { atlases.Clear(); } string[] paths = AssetDatabase.GetAllAssetPaths(); List <string> assetList = new List <string> (); for (int i = 0; i < paths.Length; i++) { if (paths [i].EndsWith(".prefab", StringComparison.OrdinalIgnoreCase) == true) { assetList.Add(paths [i]); } } for (int i = 0; i < assetList.Count; i++) { EditorUtility.DisplayProgressBar("Searching", "Searching atlases, please wait...", (float)i / assetList.Count); UnityEngine.Object target = AssetDatabase.LoadMainAssetAtPath(assetList [i]); if (target != null && target is GameObject) { UGUIAtlas atlas = (target as GameObject).GetComponent <UGUIAtlas> (); if (atlas != null) { atlases.Add(atlas); } } } EditorUtility.ClearProgressBar(); SortAtlases(); }
private RoadNetworkDescription LoadTestFile(string name) { // XXX: How do we remove the need to construct an importer here? We need to be able to serialize a // RoadNetworkDescription object without keeping the accompanying xodr file var testFilePath = ""; foreach (var assetPath in AssetDatabase.GetAllAssetPaths()) { if (assetPath.Contains("Test") && assetPath.Contains("XodrFiles") && assetPath.Contains(name)) { testFilePath = assetPath; break; } } Assert.AreNotEqual("", testFilePath, $"Failed to find {name} test file."); var factory = new OpenDriveMapElementFactory(); Assert.IsTrue(factory.TryCreateRoadNetworkDescription(XDocument.Load(testFilePath), out var roadNetwork), $"Failed to create test road network from {testFilePath}"); return(roadNetwork); }
/// <summary> /// 生成包中资源 /// </summary> public void RefreshAssetBundleDict() { assetBundleDict = new Dictionary <string, List <string> >(); var allAssetPaths = AssetDatabase.GetAllAssetPaths(); foreach (var assetPath in allAssetPaths) { if (IsIgnore(assetPath)) { continue; } var ai = AssetImporter.GetAtPath(assetPath); string abName = ai.assetBundleName; if (string.IsNullOrEmpty(abName)) { abName = "none"; } if (!assetBundleDict.ContainsKey(abName)) { assetBundleDict.Add(abName, new List <string>()); } if (!assetBundleDict[abName].Contains(assetPath)) { assetBundleDict[abName].Add(assetPath); var deps = AssetDatabase.GetDependencies(assetPath); foreach (var dep in deps) { var depai = AssetImporter.GetAtPath(dep); if (string.IsNullOrEmpty(depai.assetBundleName) && !assetBundleDict[abName].Contains(dep) && !IsIgnore(dep)) { assetBundleDict[abName].Add(dep + "(依赖未标记的资源)"); } } } } }
internal System.Collections.IEnumerator BuildAsync(int progressId, object userData = null) { string[] paths; if (settings.roots == null || settings.roots.Length == 0) { paths = AssetDatabase.GetAllAssetPaths(); } else { paths = AssetDatabase.FindAssets(String.Empty, settings.roots.Where(r => Directory.Exists(r)).ToArray()) .Select(AssetDatabase.GUIDToAssetPath).ToArray(); } paths = paths.Where(path => !SkipEntry(path)).ToArray(); var pathIndex = 0; var pathCount = (float)paths.Length; Start(clear: true); EditorApplication.LockReloadAssemblies(); foreach (var path in paths) { var progressReport = pathIndex++ / pathCount; reportProgress?.Invoke(progressId, path, progressReport, false); IndexAsset(path, false); yield return(null); } EditorApplication.UnlockReloadAssemblies(); Finish(useFinishThread); while (!IsReady()) { yield return(null); } reportProgress?.Invoke(progressId, $"Indexing Completed (Documents: {documentCount}, Indexes: {indexCount:n0})", 1f, true); yield return(null); }
public static void BuildAssetPack() { Init = true; AddressableAssetSettings setting = AddressableAssetSettingsDefaultObject.Settings; AddressableAssetGroup group = setting.FindGroup("AssetGroup"); List <AddressableAssetEntry> temp = group.entries.ToList(); foreach (var item in temp) { setting.RemoveAssetEntry(item.guid); } string[] p = AssetDatabase.GetAllAssetPaths(); for (int i = 0; i < p.Length; i++) { if (CanPack(p[i])) { setting.CreateOrMoveEntry(AssetDatabase.AssetPathToGUID(p[i]), group); } } }
public static IEnumerable <T> GetAllAssetsOfType <T>() { if (typeof(UnityObject).IsAssignableFrom(typeof(T))) { return(AssetDatabase.FindAssets($"t:{typeof(T).Name}") .Select(AssetDatabase.GUIDToAssetPath) .Select(AssetDatabase.LoadMainAssetAtPath) .OfType <T>()); } else { // GetAllAssetPaths is undocumented and sometimes returns // paths that are outside the assets folder, hence the where filter. var result = AssetDatabase.GetAllAssetPaths() .Where(p => p.StartsWith("Assets")) .Select(AssetDatabase.LoadMainAssetAtPath) .OfType <T>(); EditorUtility.UnloadUnusedAssetsImmediate(); return(result); } }
public static List <SubProjectData> SearchAllInProject() { return(AssetDatabase.GetAllAssetPaths().Where(assetPath => assetPath.EndsWith(".asset")) .Select(assetPath => { var subProject = AssetDatabase.LoadAssetAtPath <SubProject>(assetPath); if (subProject) { return new SubProjectData() { Path = assetPath, Folder = assetPath.RemoveString(subProject.name + ".asset"), Name = subProject.name, }; } return null; }) .Where(data => data != null) .ToList()); }
public static void UpgradeAllAnimationClips() { var assets = AssetDatabase.GetAllAssetPaths(); int i = 0; foreach (var a in assets) { i++; if (!a.EndsWith(".anim", StringComparison.OrdinalIgnoreCase)) { continue; } if (EditorUtility.DisplayCancelableProgressBar("Updating Animation Clips", a, (float)i / assets.Length)) { break; } string original = File.ReadAllText(a); string file = original; foreach (var v in vectors) { file = file.Replace(v + ".r", v + ".x"); file = file.Replace(v + ".g", v + ".y"); file = file.Replace(v + ".b", v + ".z"); file = file.Replace(v + ".a", v + ".w"); } if (file != original) { File.WriteAllText(a, file); } } EditorUtility.ClearProgressBar(); AssetDatabase.Refresh(); }
/// <summary> /// 清除所有AssetBundleName /// 工程中只要设置了AssetBundleName的,都会进行打包 /// </summary> internal static void ClearAssetBundleNames() { // string[] allAssetBundleNames = AssetDatabase.GetAllAssetBundleNames(); // for (int i = 0; i < allAssetBundleNames.Length; i++) // { // string text = allAssetBundleNames[i]; // EditorUtility.DisplayProgressBar(string.Format("Clear AssetBundles {0}/{1}", i, allAssetBundleNames.Length), text, i * 1f / allAssetBundleNames.Length); // AssetDatabase.RemoveAssetBundleName(text, true); // } var assets = AssetDatabase.GetAllAssetPaths(); // 获取所有有AssetBundleName的资源 assets = System.Array.FindAll <string>(assets, (asset) => { // 不带后缀的AssetBundle bool ok = !string.IsNullOrEmpty(AssetDatabase.GetImplicitAssetBundleName(asset)); // 带后缀的AssetBundle if (!ok) { ok = !string.IsNullOrEmpty(AssetDatabase.GetImplicitAssetBundleVariantName(asset)); } return(ok); }); var max = assets.Length; for (int i = 0; i < max; i++) { var asset = assets[i]; UnityEditor.EditorUtility.DisplayProgressBar(string.Format("Clear AssetBundles {0}/{1}", i, max), asset, i * 1f / max); var ai = AssetImporter.GetAtPath(asset); if (!string.IsNullOrEmpty(ai.assetBundleName)) { ai.assetBundleName = string.Empty; } } AssetDatabase.RemoveUnusedAssetBundleNames(); AssetDatabase.Refresh(); UnityEditor.EditorUtility.ClearProgressBar(); }
/// <summary> /// 批量改变纹理格式 /// </summary> public void BatchChangeTextureFormat() { string[] paths = AssetDatabase.GetAllAssetPaths(); List <string> pngPaths = new List <string>(); foreach (string p in paths) { if (p.Contains("/Atlas/")) { if (p.EndsWith(".png")) { pngPaths.Add(p); } } } for (int i = 0; i < pngPaths.Count; ++i) { this.DisplayProgress("批量改变纹理格式", pngPaths[i], i, pngPaths.Count); this.Change(pngPaths[i]); } EditorUtility.ClearProgressBar(); }
public AssetDependencyCache() { //find all assets string[] assetPaths = AssetDatabase.GetAllAssetPaths(); assets = new AssetInfo[assetPaths.Length]; for (int i = 0; i < assetPaths.Length; i++) { assets[i].name = assetPaths[i]; } //find asset dependencies for (int i = 0; i < assets.Length; i++) { var filtered = AssetDatabase.GetDependencies(assets[i].name, false).Where(a => a != assets[i].name); assets[i].dependencies = new int[filtered.Count()]; int di = 0; foreach (var d in filtered) { assets[i].dependencies[di++] = FindAssetIndex(d); } } }
void OnInspectorUpdate() { updateCount++; if (updateCount > 10) { updateCount = 0; scenes.Clear(); sceneNames.Clear(); var paths = AssetDatabase.GetAllAssetPaths(); foreach (var p in paths) { if (Path.GetExtension(p) == ".unity") { scenes.Add(p); sceneNames.Add(Path.GetFileNameWithoutExtension(p)); } } currentScene = EditorApplication.currentScene; sceneIndex = scenes.IndexOf(currentScene); Repaint(); } }
/// <summary> /// Open a script via code, the type name has to correspond with the class name for it to work. /// </summary> /// <param name="type"></param> public static void OpenScript(Type type) { string fileName = type.Name.ToString() + ".cs"; foreach (var assetPath in AssetDatabase.GetAllAssetPaths()) { if (assetPath.EndsWith(fileName)) { var script = (MonoScript)AssetDatabase.LoadAssetAtPath(assetPath, typeof(MonoScript)); if (script != null) { bool success = AssetDatabase.OpenAsset(script); if (!success) { Debug.LogError("Unable to open " + fileName); } return; } } } Debug.LogError("Unable to find " + fileName); }
private static LSMRepository GetRepository() { string path = ""; foreach (string p in AssetDatabase.GetAllAssetPaths()) { if ("LSMRepository".Equals(Path.GetFileNameWithoutExtension(p))) { path = Path.GetDirectoryName(p); } } LSMRepository instance = AssetDatabase.LoadAssetAtPath <LSMRepository>(path + "/LSMRepository.asset"); if (instance == null) { instance = CreateInstance <LSMRepository>(); AssetDatabase.CreateAsset(instance, path + "/LSMRepository.asset"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } return(instance); }
private void Init() { this.existingList = new HashSet <string>(); for (int i = 0; i < this.origin.assets.Length; i++) { this.existingList.Add(this.origin.assets[i].asset); } string[] assets = AssetDatabase.GetAllAssetPaths(); this.root = new Folder(null, "Assets"); for (int i = 0; i < assets.Length; i++) { if (assets[i].StartsWith("Assets/") == true && File.Exists(assets[i]) == true) { this.Generate(assets[i]); } } }
public static void CreateMonolith(string path = "Assets/UniScript/Resources/uniscript/monolith.txt") { Debug.Log("<b>[UniScript]</b> CreateMonolith"); var monolith = new Dictionary <string, string>(); foreach (var csx in AssetDatabase.GetAllAssetPaths() .Where(x => x.EndsWith(".csx"))) { monolith[csx] = File.ReadAllText(csx); } var json = UniScriptInternal.MiniJSON.Json.Serialize(monolith); var outPath = path; File.WriteAllText(outPath, json); AssetDatabase.ImportAsset(outPath); Debug.Log($"<b>[UniScript]</b> Merged {monolith.Count} scripts."); Debug.Log(json); }
public static void RebuildDatabase() { pathToAssetInfo = new Dictionary <string, AssetInfo>(); var allAssetPaths = AssetDatabase.GetAllAssetPaths(); // Ignore non-assets (package folder for instance) and directories allAssetPaths = allAssetPaths.Where(x => x.StartsWith("Assets/") && !Directory.Exists(x)).ToArray(); EditorUtility.DisplayProgressBar("Building Dependency Database", "Gathering All Assets...", 0f); // Gather all assets for (int p = 0; p < allAssetPaths.Length; p++) { AssetInfo assetInfo = new AssetInfo(allAssetPaths[p]); pathToAssetInfo.Add(assetInfo.path, assetInfo); } // Find links between assets for (int p = 0; p < allAssetPaths.Length; p++) { if (p % 10 == 0) { var cancel = EditorUtility.DisplayCancelableProgressBar("Building Dependency Database", allAssetPaths[p], (float)p / allAssetPaths.Length); if (cancel) { pathToAssetInfo = null; break; } } AddAssetToDatabase(allAssetPaths[p]); } EditorUtility.ClearProgressBar(); ProjectCuratorData.IsUpToDate = true; SaveDatabase(); }
private static bool SearchForInternalResourcesPath(out string path) { path = ""; string partialPath = "/com.shaderforge/Editor/InternalResources/"; string foundPath = null; foreach (string s in AssetDatabase.GetAllAssetPaths()) { if (s.Contains(partialPath)) { foundPath = s; break; } } if (foundPath == null) { return(false); } string[] split = foundPath.Replace(partialPath, "#").Split('#'); path = split[0] + partialPath; return(true); }