using RPGCoreCommon.Helpers.PropertyAttributeDrawers; using UnityEditor; using UnityEditor.UIElements; using UnityEngine.UIElements; namespace RPGCoreCommon.Helpers.Editor.PropertyAttributeDrawers { [CustomPropertyDrawer(typeof(ReadOnlyAttribute))] public class ReadOnlyDrawer : PropertyDrawer { public override VisualElement CreatePropertyGUI(SerializedProperty property) { var propertyField = new PropertyField(property); propertyField.name = "ReadOnly"; propertyField.RegisterCallback(_ => propertyField.SetEnabled(false)); return propertyField; } } }