You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
525 B
16 lines
525 B
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
|
|
public class ReadOnlyAttributeDrawer : PropertyDrawer
|
|
{
|
|
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
|
=> EditorGUI.GetPropertyHeight(property, label, true);
|
|
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
|
{
|
|
GUI.enabled = false;
|
|
EditorGUI.PropertyField(position, property, label, true);
|
|
GUI.enabled = true;
|
|
}
|
|
}
|