2.2 KiB
2.2 KiB
17:23
unity日常积累
节奏天国
帧同步王者荣耀
从零开发跨平台通用日志插件
通用异步网络通信库
高性能定时系统实现
学习资料
其他
看板
今日任务
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace DefaultNamespace
{
public class SkinToolEditor : EditorWindow
{
private static SkinToolEditor m_Window;
private List<string> registeredNames = new List<string>();
List<Component> registeredCompsEditorOnly = new List<Component>();
[MenuItem("GameObject/测试Actor", false, 1)]
static void ShowWindow()
{
if (m_Window == null)
{
m_Window = (SkinToolEditor)EditorWindow.GetWindow(typeof(SkinToolEditor), true, "SkinToolEditor");
m_Window.Show();
}
else
{
m_Window.Close();
m_Window = null;
}
}
void OnGUI()
{
for (int i = 0; i < registeredNames.Count; i++)
{
GUILayout.BeginHorizontal("box");
EditorGUI.BeginChangeCheck();
string compName = EditorGUILayout.TextField(registeredNames[i]);
if (EditorGUI.EndChangeCheck())
{
Debug.Log("change");
}
Component compVal =
EditorGUILayout.ObjectField(registeredCompsEditorOnly[i], typeof(Component), true) as Component;
if (GUILayout.Button("X"))
{
Debug.Log("Close");
}
GUILayout.EndHorizontal();
}
if (GUILayout.Button("添加"))
{
registeredNames.Add("sasa");
registeredCompsEditorOnly.Add(null);
Debug.Log("add");
}
if (GUILayout.Button("保存"))
{
Debug.Log("save");
}
}
}
}