Odin has a dedicated attribute overview with examples

CustomContextMenuAttribute 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, AllowMultiple = true, Inherited = true)]
public sealed class CustomContextMenuAttribute : Attribute, _Attribute

CustomContextMenu is used on any property, and adds a custom options to the context menu for the property.

Use this for when you want to add custom actions to the context menu of a property.

  • System.Object
  • System.Attribute
  • CustomContextMenuAttribute


CustomContextMenu currently does not support static functions.


The following example shows how CustomContextMenu is used to add a custom option to a property.

public class MyComponent : MonoBehaviour
	[CustomContextMenu("My custom option", "MyAction")]
	public Vector3 MyVector;

	private void MyAction()
		MyVector = Random.onUnitSphere;


CustomContextMenuAttribute(String, String)
Adds a custom option to the context menu of the property.
public CustomContextMenuAttribute(string menuItem, string methodName)
System.String menuItem

The name of the menu item.

System.String methodName

The name of the callback method.


The name of the menu item.
public string MenuItem
The name of the callback method.
public string MethodName

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.