Toggle is used on any field or property, and allows to enable or disable the property in the inspector.

Use this to create a property that can be turned off or on.

namespace Sirenix.OdinInspector
[AttributeUsageAttribute((AttributeTargets)384, AllowMultiple = False, Inherited = True)]
public sealed class ToggleAttribute : Attribute


Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector

See Also


Definition Description
ToggleAttribute(string) Create a togglable property in the inspector.


Return Type Definition Description
bool CollapseOthersOnExpand If true, all other open toggle groups will collapse once another one opens.
string ToggleMemberName Name of any bool field or property to enable or disable the object.


The following example shows how Toggle is used to create a togglable property.

public class MyComponent : MonoBehaviour
	public MyToggleable MyToggler = new MyToggleable();

public class MyToggleable
	public bool Enabled;

	public int MyValue;