diff --git a/Editor/GUIDToAssetPath.cs b/Editor/GUIDToAssetPath.cs new file mode 100644 index 0000000..f4e5aae --- /dev/null +++ b/Editor/GUIDToAssetPath.cs @@ -0,0 +1,41 @@ +using UnityEditor; +using UnityEngine; + +public class GUIDToAssetPath : EditorWindow +{ + string guid = ""; + string path = ""; + [MenuItem("Tools/GUIDToAssetPath")] + static void CreateWindow() + { + GUIDToAssetPath window = (GUIDToAssetPath)EditorWindow.GetWindowWithRect(typeof(GUIDToAssetPath), new Rect(0, 0, 400, 120)); + } + + void OnGUI() + { + GUILayout.Label("Enter guid"); + guid = GUILayout.TextField(guid); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + if (GUILayout.Button("Get Asset Path",GUILayout.Width(120))) + path = GetAssetPath(guid); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + if (GUILayout.Button("Abort", GUILayout.Width(120))) + Close(); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.Label(path); + } + static string GetAssetPath(string guid) + { + guid = guid.Replace("-", ""); + + string p = AssetDatabase.GUIDToAssetPath(guid); + Debug.Log(p); + if (p.Length == 0) p = "not found"; + return p; + } +} \ No newline at end of file diff --git a/Editor/GUIDToAssetPath.cs.meta b/Editor/GUIDToAssetPath.cs.meta new file mode 100644 index 0000000..693beae --- /dev/null +++ b/Editor/GUIDToAssetPath.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ee5c0a00075140f28ac5e6ff46e9a6b3 +timeCreated: 1669777021 \ No newline at end of file