Created
December 23, 2018 11:25
-
-
Save Kirbyrawr/c0f2e9016ab2da3afc407e81adec0b7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
public class EditorStyleViewer : EditorWindow | |
{ | |
Vector2 scrollPosition = new Vector2(0, 0); | |
string search = ""; | |
[MenuItem("Window/Editor Style Viewer")] | |
public static void Init() | |
{ | |
GetWindow<EditorStyleViewer>(); | |
} | |
private void OnGUI() | |
{ | |
GUILayout.BeginHorizontal("HelpBox"); | |
GUILayout.Label("Click a Sample to copy its Name to your Clipboard", "MiniBoldLabel"); | |
GUILayout.FlexibleSpace(); | |
GUILayout.Label("Search:"); | |
search = EditorGUILayout.TextField(search); | |
GUILayout.EndHorizontal(); | |
scrollPosition = GUILayout.BeginScrollView(scrollPosition); | |
foreach (GUIStyle style in GUI.skin.customStyles) | |
{ | |
if (style.name.ToLower().Contains(search.ToLower())) | |
{ | |
GUILayout.BeginHorizontal("PopupCurveSwatchBackground"); | |
GUILayout.Space(7); | |
if (GUILayout.Button(style.name, style)) | |
{ | |
EditorGUIUtility.systemCopyBuffer = "\"" + style.name + "\""; | |
} | |
GUILayout.FlexibleSpace(); | |
EditorGUILayout.SelectableLabel("\"" + style.name + "\""); | |
GUILayout.EndHorizontal(); | |
GUILayout.Space(11); | |
} | |
} | |
GUILayout.EndScrollView(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment