working on dialogs system
This commit is contained in:
parent
b7aa670e70
commit
cd8c819585
41
Editor/EditorUtils.cs
Normal file
41
Editor/EditorUtils.cs
Normal file
@ -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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Editor/EditorUtils.cs.meta
Normal file
3
Editor/EditorUtils.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a4848b69c1024df8ad6f76cfd4415d01
|
||||||
|
timeCreated: 1698258811
|
||||||
Loading…
x
Reference in New Issue
Block a user