public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (!(attribute is ReadOnlyAttribute conditional)) { return; } bool enabled = !ConditionalUtility.IsPropertyConditionMatch(property, conditional.Data); GUI.enabled = enabled; EditorGUI.PropertyField(position, property, label, true); GUI.enabled = true; }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { if (!(attribute is ConditionalFieldAttribute conditional)) { return(EditorGUI.GetPropertyHeight(property)); } CachePropertyDrawer(property); _toShow = ConditionalUtility.IsPropertyConditionMatch(property, conditional.Data); if (!_toShow) { return(0); } if (_customPropertyDrawer != null) { return(_customPropertyDrawer.GetPropertyHeight(property, label)); } return(EditorGUI.GetPropertyHeight(property)); }