public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { ConditionalHideInterfaceAttribute condHAtt = (ConditionalHideInterfaceAttribute)attribute; bool enabled = GetConditionalHideAttributeResult(condHAtt, property); bool wasEnabled = GUI.enabled; GUI.enabled = enabled; //if (!condHAtt.HideInInspector || enabled) if (condHAtt.Behavior != ConditionalHideBehavior.Hide || enabled) { EditorGUI.PropertyField(position, property, label, true); } GUI.enabled = wasEnabled; }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { ConditionalHideInterfaceAttribute condHAtt = (ConditionalHideInterfaceAttribute)attribute; bool enabled = GetConditionalHideAttributeResult(condHAtt, property); //if (!condHAtt.HideInInspector || enabled) if (condHAtt.Behavior != ConditionalHideBehavior.Hide || enabled) { return(EditorGUI.GetPropertyHeight(property, label)); } else { //The property is not being drawn //We want to undo the spacing added before and after the property return(-EditorGUIUtility.standardVerticalSpacing); } }
public virtual bool GetConditionalHideAttributeResult(ConditionalHideInterfaceAttribute condHAtt, SerializedProperty property) { return(condHAtt.GetConditionalHideAttributeResult(property)); }