Advertisement
hybrid-dragon

CustomLabelDrawer.cs

Jul 10th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEditor;
  3.  
  4. [CustomPropertyDrawer(typeof(LabelAttribute), true)]
  5. public class CustomLabelDrawer : PropertyDrawer
  6. {
  7.     public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
  8.     {
  9.         try
  10.         {
  11.             EditorGUI.PropertyField(rect, property, new GUIContent(((LabelAttribute)attribute).Label));
  12.         }
  13.         catch
  14.         {
  15.             EditorGUI.PropertyField(rect, property, label);
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement