From cd8c819585c47c371241c19c5ce74726731f8a56 Mon Sep 17 00:00:00 2001 From: BitterSmile Date: Wed, 25 Oct 2023 20:52:17 +0200 Subject: [PATCH] working on dialogs system --- Editor/EditorUtils.cs | 41 ++++++++++++++++++++++++++++++++++++++ Editor/EditorUtils.cs.meta | 3 +++ 2 files changed, 44 insertions(+) create mode 100644 Editor/EditorUtils.cs create mode 100644 Editor/EditorUtils.cs.meta diff --git a/Editor/EditorUtils.cs b/Editor/EditorUtils.cs new file mode 100644 index 0000000..9300f6d --- /dev/null +++ b/Editor/EditorUtils.cs @@ -0,0 +1,41 @@ +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]); + } + } +} \ No newline at end of file diff --git a/Editor/EditorUtils.cs.meta b/Editor/EditorUtils.cs.meta new file mode 100644 index 0000000..dce6f9c --- /dev/null +++ b/Editor/EditorUtils.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a4848b69c1024df8ad6f76cfd4415d01 +timeCreated: 1698258811 \ No newline at end of file