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 = false, Inherited = true)]
[Conditional("UNITY_EDITOR")]
public sealed class ToggleAttribute : Attribute, _Attribute
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.
Toggle does current not support any static members for toggling.
The following example shows how Toggle is used to create a toggleable property.
public class MyComponent : MonoBehaviour
{
[Toggle("Enabled")]
public MyToggleable MyToggler = new MyToggleable();
}
public class MyToggleable
{
public bool Enabled;
public int MyValue;
}
public ToggleAttribute(string toggleMemberName)
System.String | toggleMemberName | Name of any bool field or property to enable or disable the object. |
public bool CollapseOthersOnExpand
public string ToggleMemberName