Version 3.3.1.2

Odin has a dedicated attribute overview with examples

DisableContextMenuAttribute 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, AllowMultiple = false, Inherited = true)]
[Conditional("UNITY_EDITOR")]
public sealed class DisableContextMenuAttribute : Attribute, _Attribute

DisableContextMenu is used on any property and disables the context menu for that property.

Use this if you do not want the context menu to be available for a property.

Inheritance
  • System.Object
  • System.Attribute
  • DisableContextMenuAttribute
Example

The following example shows how DisableContextMenu is used on a property.

public class MyComponent : MonoBehaviour
{
	[DisableContextMenu]
	public Vector3 MyVector;
}

Constructors

DisableContextMenuAttribute(Boolean, Boolean)
Initializes a new instance of the DisableContextMenuAttribute class.
public DisableContextMenuAttribute(bool disableForMember = true, bool disableCollectionElements = false)
Parameters
System.Boolean disableForMember

Whether to disable the context menu for the member itself.

System.Boolean disableCollectionElements

Whether to also disable the context menu of collection elements.

Fields

DisableForCollectionElements
Whether to disable the context menu for collection elements.
public bool DisableForCollectionElements
DisableForMember
Whether to disable the context menu for the member itself.
public bool DisableForMember