该项目的目的是同时测试和演示来自 Unity DOTS 技术堆栈的多个新包。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

62 行
1.7 KiB

using UnityEditor;
using UnityEngine;
public class LookupAssetWindow : EditorWindow
{
[MenuItem("A2/Hotkeys/Lookup asset guid %&l")]
static void LookupAsset()
{
Open();
}
public static void Open()
{
LookupAssetWindow window = GetWindow<LookupAssetWindow>(false);
window.position = new Rect(Screen.width / 2, Screen.height / 2, 800, 150);
window.ShowPopup();
guid = "";
}
static string guid;
static Object asset;
static string path;
void OnGUI()
{
EditorGUILayout.LabelField("Enter asset GUID below", EditorStyles.wordWrappedLabel);
GUILayout.Space(20);
EditorGUI.BeginChangeCheck();
guid = EditorGUILayout.TextField("GUID", guid);
var guidChanged = EditorGUI.EndChangeCheck();
EditorGUI.BeginChangeCheck();
path = EditorGUILayout.TextField("Asset", path);
var pathChanged = EditorGUI.EndChangeCheck();
EditorGUI.BeginChangeCheck();
asset = EditorGUILayout.ObjectField("Asset", asset, typeof(Object), false);
var assetChanged = EditorGUI.EndChangeCheck();
GUILayout.Space(20);
if (GUILayout.Button("Close"))
this.Close();
if (guidChanged)
{
path = AssetDatabase.GUIDToAssetPath(guid);
asset = AssetDatabase.LoadAssetAtPath(path, typeof(Object));
}
else if (pathChanged)
{
asset = AssetDatabase.LoadAssetAtPath(path, typeof(Object));
guid = AssetDatabase.AssetPathToGUID(path);
}
else if (assetChanged)
{
path = AssetDatabase.GetAssetPath(asset);
guid = AssetDatabase.AssetPathToGUID(path);
}
}
}