Version 2.1.0.0

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)]
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

This website is brand new and built with the Odin 2.1 beta in mind. This means you might discover some features such as attribute expressions that are only available in the beta.

You can download the 2.1 beta from here and read the patch-notes here.