Version 2.1.0.0

Odin has a dedicated attribute overview with examples

FoldoutGroupAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter | AttributeTargets.All, AllowMultiple = true, Inherited = true)]
public class FoldoutGroupAttribute : PropertyGroupAttribute, _Attribute

FoldoutGroup is used on any property, and organizes properties into a foldout.

Use this to organize properties, and to allow the user to hide properties that are not relevant for them at the moment.

Inheritance
Example

The following example shows how FoldoutGroup is used to organize properties into a foldout.

public class MyComponent : MonoBehaviour
{
	[FoldoutGroup("MyGroup")]
	public int A;

	[FoldoutGroup("MyGroup")]
	public int B;

	[FoldoutGroup("MyGroup")]
	public int C;
}
Example

The following example shows how properties can be organizes into multiple foldouts.

public class MyComponent : MonoBehaviour
{
	[FoldoutGroup("First")]
	public int A;

	[FoldoutGroup("First")]
	public int B;

	[FoldoutGroup("Second")]
	public int C;
}

Constructors

FoldoutGroupAttribute(String, Boolean, Int32)
Adds the property to the specified foldout group.
public FoldoutGroupAttribute(string groupName, bool expanded, int order = 0)
Parameters
System.String groupName

Name of the foldout group.

System.Boolean expanded

Whether or not the foldout should be expanded by default.

System.Int32 order

The order of the group in the inspector.

FoldoutGroupAttribute(String, Int32)
Adds the property to the specified foldout group.
public FoldoutGroupAttribute(string groupName, int order = 0)
Parameters
System.String groupName

Name of the foldout group.

System.Int32 order

The order of the group in the inspector.

Fields

Expanded
Gets a value indicating whether or not the foldout should be expanded by default..
public bool Expanded

Properties

HasDefinedExpanded
Gets a value indicating whether or not the Expanded property has been set.
public bool HasDefinedExpanded { get; }

Methods

CombineValuesWith(PropertyGroupAttribute)
Combines the foldout property with another.
protected override void CombineValuesWith(PropertyGroupAttribute other)
Parameters
PropertyGroupAttribute other

The group to combine with.