Version 3.3.1.2

Odin has a dedicated attribute overview with examples

HideInPlayModeAttribute 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)]
[DontApplyToListElements]
[Conditional("UNITY_EDITOR")]
public class HideInPlayModeAttribute : Attribute, _Attribute

HideInPlayMode is used on any property, and hides the property when not in editor mode.

Use this when you only want a property to only be visible the editor.

Inheritance
  • System.Object
  • System.Attribute
  • HideInPlayModeAttribute
Example

The following example shows how HideInPlayMode is used to hide a property when in play mode.

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

Constructors

HideInPlayModeAttribute()
public HideInPlayModeAttribute()