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)32767, AllowMultiple = True, Inherited = True)]
[DontApplyToListElementsAttribute]
public sealed class CustomContextMenuAttribute : Attribute
}

Requirements

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector
Version: 2.0.0.0

See Also

Fields

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

Constructors

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

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