Skip to content

Instantly share code, notes, and snippets.

@dimmduh
Created October 6, 2017 07:31
Show Gist options
  • Save dimmduh/d059c9b04ff883ef2b5463889f6ed1de to your computer and use it in GitHub Desktop.
Save dimmduh/d059c9b04ff883ef2b5463889f6ed1de to your computer and use it in GitHub Desktop.
Label for inspector. Put to Editor folder
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