CustomContextMenuAttribute

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.

namespace Sirenix.OdinInspector
{
[AttributeUsageAttribute((AttributeTargets)384, AllowMultiple = True, Inherited = True)]
[DontApplyToListElementsAttribute]
public sealed class CustomContextMenuAttribute : Attribute
}

Requirements

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector
Version: 1.0.4.1

See Also

Constructors

Definition Description
CustomContextMenuAttribute(string, string) Adds a custom option to the context menu of the property.

Properties

Return Type Definition Description
string MenuItem The name of the menu item.
string MethodName The name of the callback method.

Example

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;
	}
}