docs.unity.cn
    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.unity.cn/ScriptReference/MenuItem.html).

    Inheritance
    Object
    Attribute
    MenuEntryAttribute
    Inherited Members
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, Boolean)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, Boolean)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, Boolean)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, Boolean)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, Boolean)
    Attribute.GetCustomAttributes(ParameterInfo, Boolean)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, Boolean)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, Boolean)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, Boolean)
    Attribute.GetCustomAttributes(Module, Type, Boolean)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, Boolean)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, Boolean)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, Boolean)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, Boolean)
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, Boolean)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, Boolean)
    Attribute.Equals(Object)
    Attribute.GetHashCode()
    Attribute.Match(Object)
    Attribute.IsDefaultAttribute()
    Attribute._Attribute.GetTypeInfoCount(UInt32)
    Attribute._Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)
    Attribute._Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
    Attribute._Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)
    Attribute.TypeId
    Object.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    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.

    See Also
    MenuPriority
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023