Class MenuEntryAttribute
Use this attribute to add a menu item to a context menu. Used to indicate path and priority that are auto added to the menu (examples can be found on https://docs.unity3d.com/ScriptReference/MenuItem.html).
Inherited Members
Namespace: UnityEditor.Timeline.Actions
Syntax
[AttributeUsage(AttributeTargets.Class)]
public class MenuEntryAttribute : Attribute, _Attribute
Remarks
Unlike Menu item, MenuEntryAttribute doesn't handle shortcuts in the menu name. See TimelineShortcutAttribute.
Examples
[MenuEntry("Simple Menu Action")]
class SimpleMenuAction : TimelineAction
{
public override ActionValidity Validate(ActionContext actionContext)
{
return ActionValidity.Valid;
}
public override bool Execute(ActionContext actionContext)
{
return true;
}
}
[MenuEntry("Menu Action with priority", 9999)]
class MenuActionWithPriority : TimelineAction
{
public override ActionValidity Validate(ActionContext actionContext)
{
return ActionValidity.Valid;
}
public override bool Execute(ActionContext actionContext)
{
return true;
}
}
[MenuEntry("My Menu/Menu Action inside submenu")]
class MenuActionInsideSubMenu : TimelineAction
{
public override ActionValidity Validate(ActionContext actionContext)
{
return ActionValidity.Valid;
}
public override bool Execute(ActionContext actionContext)
{
return true;
}
}
Constructors
MenuEntryAttribute(String, Int32)
Constructor for Menu Entry Attribute to define information about the menu item for an action.
Declaration
public MenuEntryAttribute(string path = null, int priority = 9000)
Parameters
Type | Name | Description |
---|---|---|
String | path | Path to the menu. If there is a "/" in the path, it will create one (or multiple) submenu items. |
Int32 | priority | Priority to decide where the menu will be positioned in the menu. The lower the priority, the higher the menu item will be in the context menu. |