On State Update Attribute

OnStateUpdate provides an event callback when the property's state should be updated, or rather, when the IOnStateUpdate interface gets invoked. This generally happens at least once per frame, and the callback will be invoked even when the property is not visible. This can be used to approximate custom state controllers like [ShowIf] without needing to make entire attributes and drawers for one-off cases.

public List<string> list;

[OnStateUpdate("@#(list).State.Expanded = $value")]
public bool ExpandList;

[OnStateUpdate("@$property.State.Expanded = ExpandList")]
public List<string> list;

public bool ExpandList;

[OnStateUpdate("@$property.State.Visible = ToggleMyInt")]
public int MyInt;

public bool ToggleMyInt;