Show Group If Attribute

The ShowIfGroup is an attribute that allows for showing or hiding a group of properties based on a condition. The attribute is a group attribute and can therefore be combined with other group attributes, and even be used to show or hide entire groups.

public bool Toggle = true;

[ShowGroupIf("Toggle")]
[BoxGroup("Toggle/Shown Box")]
public int A, B;

[BoxGroup("Box")]
public InfoMessageType EnumField = InfoMessageType.Info;

[BoxGroup("Box")]
[ShowGroupIf("Box/Toggle")]
public Vector3 X, Y;

// Like the regular If-attributes, ShowGroupIf also supports specifying values.
// You can also chain multiple ShowGroupIf attributes together for more complex behaviour.
[ShowGroupIf("Box/Toggle/EnumField", Value = InfoMessageType.Info)]
[BoxGroup("Box/Toggle/EnumField/Border", ShowLabel = false)]
public string Name;

[BoxGroup("Box/Toggle/EnumField/Border")]
public Vector3 Vector;

// ShowGroupIf will by default use the name of the group,
// but you can also use the MemberName property to override this.
[ShowGroupIf("RectGroup", MemberName = "Toggle")]
public Rect Rect;

This website is brand new and built with the Odin 2.1 beta in mind. This means you might discover some features such as attribute expressions that are only available in the beta.

You can download the 2.1 beta from here and read the patch-notes here.