Created
October 6, 2017 07:31
-
-
Save dimmduh/d059c9b04ff883ef2b5463889f6ed1de to your computer and use it in GitHub Desktop.
Label for inspector. Put to Editor folder
This file contains hidden or 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 UnityEditor; | |
using UnityEngine; | |
public class InspectorLabel : MonoBehaviour | |
{ | |
} | |
[CustomEditor(typeof(InspectorLabel))] | |
public class InspectorLabelEditor : Editor | |
{ | |
private Color color = Color.black; | |
private int size; | |
private string text; | |
public override void OnInspectorGUI() | |
{ | |
var labelStyle = new GUIStyle(EditorStyles.largeLabel); | |
color = EditorGUILayout.ColorField(color); | |
size = EditorGUILayout.IntSlider(size, 10, 200); | |
text = EditorGUILayout.TextField("text:", text); | |
labelStyle.normal.textColor = color; | |
labelStyle.fontSize = size; | |
GUILayout.Label(text, labelStyle); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment