因為上一篇文章中我懷疑現(xiàn)在的GUIStyle已經(jīng)不包含一些過時的了戳鹅,所以驗證了一下旭贬,參考了
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