Tanoda
ReadOnlyDrawer.cs
Go to the documentation of this file.
1
4using UnityEditor;
5
7{
8 [CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
9 public class ReadOnlyDrawer : PropertyDrawer
10 {
11
12 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
13 {
14 GUI.enabled = false;
15 EditorGUI.PropertyField(position, property, label, true);
16 GUI.enabled = true;
17 }
18 }
19}
override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
Credit Erdener Gonenc - @PixelEnvision.