using System.Collections.Generic; using UnityEngine; namespace AlicizaX.AnimationFlow.Editor { public static class EditorResourceTool { public static string editorAssets; public static bool LocateEditorAssets() { string projectPath = Application.dataPath; if (projectPath.EndsWith("/Assets")) { projectPath = projectPath.Remove(projectPath.Length - ("Assets".Length)); } editorAssets = "Packages/com.alicizax.unity.animationflow/Editor/Styles"; if (!System.IO.File.Exists(projectPath + editorAssets + "/AnimationFlowStyles.uss")) { var sdir = new System.IO.DirectoryInfo(Application.dataPath); var dirQueue = new Queue(); dirQueue.Enqueue(sdir); bool found = false; while (dirQueue.Count > 0) { System.IO.DirectoryInfo dir = dirQueue.Dequeue(); if (System.IO.File.Exists(dir.FullName + "/AnimationFlowStyles.uss")) { string path = dir.FullName.Replace('\\', '/'); found = true; path = path.Replace(projectPath, ""); if (path.StartsWith("/")) { path = path.Remove(0, 1); } editorAssets = path; return true; } var dirs = dir.GetDirectories(); for (int i = 0; i < dirs.Length; i++) { dirQueue.Enqueue(dirs[i]); } } if (!found) { Debug.LogWarning("Could not locate editor assets folder. Make sure you have imported the package correctly."); return false; } } return true; } } }