I have an Attribute
public class LockAttribute : PropertyAttribute { }
with a custom drawer script
[CustomPropertyDrawer(typeof(LockAttribute))]
public class LockAttributePropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginDisabledGroup(Application.isPlaying);
_= EditorGUI.PropertyField(position, property, label);
EditorGUI.EndDisabledGroup();
}
}
it's purpose is to disable the inspector field when the application is playing.
If I use it in this order
[SerializeField,Range(0,100),Lock] private int m_Resolution;
the field never disables, and when I swap the Range and Lock attributes, the Range attribute has no effect.
Is there a way to have both attributes take effect?
I attempted using
Base.OnGUI(position, property, label);
instead of
EditorGUI.PropertyField(position, property, label);
but doing so resulting in No GUI Implmented appearing over my fields`.
