Version 3.3.1.2

Odin has a dedicated attribute overview with examples

DisableInEditorModeAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[DontApplyToListElements]
[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)]
[Conditional("UNITY_EDITOR")]
public class DisableInEditorModeAttribute : Attribute, _Attribute

DisableInEditorMode is used on any property, and disables the property when not in play mode.

Use this when you only want a property to be editable when in play mode.

Inheritance
  • System.Object
  • System.Attribute
  • DisableInEditorModeAttribute
Example

The following example shows how DisableInEditorMode is used to disable a property when in the editor.

public class MyComponent : MonoBehaviour
{
	[DisableInEditorMode]
	public int MyInt;
}

Constructors

DisableInEditorModeAttribute()
public DisableInEditorModeAttribute()