Version 2.1.0.0

Odin has a dedicated attribute overview with examples

DisableInPlayModeAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field)]
[DontApplyToListElements]
public class DisableInPlayModeAttribute : Attribute, _Attribute

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

Use this to prevent users from editing a property when in play mode.

Inheritance
  • System.Object
  • System.Attribute
  • DisableInPlayModeAttribute
Example

The following example shows how DisableInPlayMode is used to disable a property when in play mode.

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

Constructors

DisableInPlayModeAttribute()
public DisableInPlayModeAttribute()