Class ShowIfAttributeDrawer
Custom property drawer for ShowIfAttribute. Handles conditional visibility of fields in the Unity Inspector.
[CustomPropertyDrawer(typeof(ShowIfAttribute))]
public class ShowIfAttributeDrawer : EnableIfAttributeDrawer
Inheritance
Derived
Inherited Members
- EnableIfAttributeDrawer.CreatePropertyGUI(SerializedProperty)
- EnableIfAttributeDrawer.UpdateState(SerializedProperty, VisualElement)
- EnableIfAttributeDrawer.GetCurrentState(SerializedProperty, EnableIfAttribute)
- EnableIfAttributeDrawer.OnGUI(Rect, SerializedProperty, GUIContent)
Methods
CreatePropertyGUI(SerializedProperty)
Creates the VisualElement-based UI for the property.
public override VisualElement CreatePropertyGUI(SerializedProperty property)
Parameters
| Name | Type | Description |
|---|---|---|
property | SerializedProperty | Serialized property being drawn. |
Returns
VisualElement — The element containing the custom GUI.
OnGUI(Rect, SerializedProperty, GUIContent)
Draws the IMGUI-based field in the Inspector.
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
Parameters
| Name | Type | Description |
|---|---|---|
position | Rect | The rectangle on screen to use for the property field. |
property | SerializedProperty | The property to draw. |
label | GUIContent | Label to display beside the property. |
UpdateState(SerializedProperty, VisualElement)
Updates the visual state of the property field based on the condition state.
protected override void UpdateState(SerializedProperty property, VisualElement container)
Parameters
| Name | Type | Description |
|---|---|---|
property | SerializedProperty | The serialized property to evaluate. |
container | VisualElement | The visual container for the property. |