Add guit to asset path
This commit is contained in:
parent
1e3aa619eb
commit
00057a04b8
41
Editor/GUIDToAssetPath.cs
Normal file
41
Editor/GUIDToAssetPath.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Editor/GUIDToAssetPath.cs.meta
Normal file
3
Editor/GUIDToAssetPath.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ee5c0a00075140f28ac5e6ff46e9a6b3
|
||||||
|
timeCreated: 1669777021
|
||||||
Loading…
x
Reference in New Issue
Block a user