public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { if (target == null) { target = attribute as ConditionAttribute; } return(!result && target.visibilityType == ConditionAttribute.VisibilityType.Hidden ? 0f : EditorGUI.GetPropertyHeight(property)); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (target == null) { target = attribute as ConditionAttribute; } bool result = CheckCondition(property); if (target.visibilityType == ConditionAttribute.VisibilityType.NotEditable) { GUI.enabled = result; EditorGUI.PropertyField(position, property, true); GUI.enabled = true; } else { if (result) { EditorGUI.PropertyField(position, property, true); } } }