using System; using UnityEditor; namespace NegUtils.Editor { public class EditorUtils { } public class AssetPath { public string Path { get { if (path != null) return path; TryFindPath(); return path; } } private string path; private readonly string filter; public AssetPath(string filter) { this.filter = filter; TryFindPath(); } private void TryFindPath() { string[] candidates = AssetDatabase.FindAssets(filter); if (candidates.Length == 0) throw new Exception("Missing layout asset!"); path = AssetDatabase.GUIDToAssetPath(candidates[0]); } } }