因为上一篇文章中我怀疑现在的GUIStyle已经不包含一些过时的了,所以验证了一下,参考了
Unity 查看Unity所有的默认UI效果 GUIStyle
自己绘制了一个查看所有默认GUI Style的界面
using UnityEditor;
using UnityEngine;
public class ShowAllGUIStyle : EditorWindow
{
private Vector2 scrollVector2 = Vector2.zero;
[MenuItem("Tools/查看所有GUIStyle", false)]
static void OpenWindow()
{
EditorWindow window = GetWindow(typeof(ShowAllGUIStyle));
window.minSize = new Vector2(300, 900);
}
private string search = string.Empty;
private void OnGUI()
{
EditorGUILayout.Space();
EditorGUILayout.BeginHorizontal();
search = EditorGUILayout.TextField("", search, "ToolbarSeachTextField");
if (GUILayout.Button("点击搜索","ToolbarSeachTextField",GUILayout.Width(80)))
{
Repaint();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
scrollVector2 = GUILayout.BeginScrollView(scrollVector2);
foreach (GUIStyle style in GUI.skin.customStyles)
{
if(style.name.Contains(search))
DrawStyleItem(style);
}
GUILayout.EndScrollView();
}
void DrawStyleItem(GUIStyle style)
{
EditorGUILayout.BeginVertical("box");
EditorGUILayout.SelectableLabel(style.name);
GUILayout.Button("", style);
EditorGUILayout.EndVertical();
}
}
顺便增加了搜索功能,
果然没有AnimationCurveEditorBackground