using UnityEditor;
using UnityEngine;
public class FindAssetByGUIDEditorWindow : EditorWindow
{
string guid = "";
string path = "";
[MenuItem("Tools/通过GUID找到资产 编辑器")]
static void CreateWindow()
{
FindAssetByGUIDEditorWindow window = (FindAssetByGUIDEditorWindow)EditorWindow.GetWindowWithRect(typeof(FindAssetByGUIDEditorWindow), new Rect(0, 0, 400, 120));
window.title = "通过GUID找到资产 编辑器";
}
void OnGUI()
{
GUILayout.Label("GUID");
guid = GUILayout.TextField(guid);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("搜索", GUILayout.Width(120))) path = GetAssetPath(guid);
if (GUILayout.Button("定位文件", GUILayout.Width(120)) && !string.IsNullOrEmpty(path)) EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath<Object>(path));
通过GUID找到资产
最新推荐文章于 2024-02-07 10:36:32 发布