docs.unity3d.com
    Show / Hide Table of Contents

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

    Inheritance
    Object
    MenuEntryAttribute
    Namespace: UnityEditor.Timeline.Actions
    Syntax
    public class MenuEntryAttribute : 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 = null)
    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.

    See Also
    MenuPriority
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023