Version 3.3.0.1

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)]
[Conditional("UNITY_EDITOR")]
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, Single)
Adds the property to the specified foldout group.
public FoldoutGroupAttribute(string groupName, bool expanded, float order = 0F)
Parameters
System.String groupName

Name of the foldout group.

System.Boolean expanded

Whether or not the foldout should be expanded by default.

System.Single order

The order of the group in the inspector.

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

Name of the foldout group.

System.Single order

The order of the group in the inspector.

Properties

Expanded
Gets a value indicating whether or not the foldout should be expanded by default.
public bool Expanded { get; set; }
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.