docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ElementAdderMenuCommandAttribute

    Annotate IElementAdderMenuCommand<TContext> implementations with a ElementAdderMenuCommandAttribute to associate it with the contract type of addable elements.

    Inheritance
    object
    Attribute
    ElementAdderMenuCommandAttribute
    Implements
    _Attribute
    Inherited Members
    Attribute.Equals(object)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetHashCode()
    Attribute.IsDefaultAttribute()
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.Match(object)
    Attribute.TypeId
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.VisualScripting.ReorderableList.Element_Adder_Menu
    Assembly: Unity.VisualScripting.Core.Editor.dll
    Syntax
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
    public sealed class ElementAdderMenuCommandAttribute : Attribute, _Attribute
    Examples

    The following source code demonstrates how to add a helper menu command to the add element menu of a shopping list:

    [ElementAdderMenuCommand(typeof(ShoppingItem))]
    public class AddFavoriteShoppingItemsCommand : IElementAdderMenuCommand<ShoppingList> {
        public AddFavoriteShoppingItemsCommand() {
            Content = new GUIContent("Add Favorite Items");
        }
    
    public GUIContent Content { get; private set; }
    
    public bool CanExecute(IElementAdder<ShoppingList> elementAdder) {
        return true;
    }
    public void Execute(IElementAdder<ShoppingList> elementAdder) {
        // xTODO: Add favorite items to the shopping list!
    }
    

    }

    @ElementAdderMenuCommand(ShoppingItem)
    class AddFavoriteShoppingItemsCommand extends IElementAdderMenuCommand.<ShoppingList> {
        var _content:GUIContent = new GUIContent('Add Favorite Items');
    
        function get Content():GUIContent { return _content; }
    
        function CanExecute(elementAdder:IElementAdder.<ShoppingList>):boolean {
            return true;
        }
        function Execute(elementAdder:IElementAdder.<ShoppingList>) {
            // xTODO: Add favorite items to the shopping list!
        }
    }

    Constructors

    ElementAdderMenuCommandAttribute(Type)

    Initializes a new instance of the ElementAdderMenuCommandAttribute class.

    Declaration
    public ElementAdderMenuCommandAttribute(Type contractType)
    Parameters
    Type Name Description
    Type contractType

    Contract type of addable elements.

    Properties

    ContractType

    Gets the contract type of addable elements.

    Declaration
    public Type ContractType { get; }
    Property Value
    Type Description
    Type

    Implements

    _Attribute

    Extension Methods

    Cloning.Clone(object, ICloner, bool)
    Cloning.Clone(object, ICloner, bool)
    Cloning.CloneViaFakeSerialization(object)
    Cloning.CloneViaFakeSerialization(object)
    ConversionUtility.ConvertTo(object, Type)
    ConversionUtility.ConvertTo(object, Type)
    ConversionUtility.ConvertTo<T>(object)
    ConversionUtility.ConvertTo<T>(object)
    ConversionUtility.IsConvertibleTo(object, Type, bool)
    ConversionUtility.IsConvertibleTo(object, Type, bool)
    ConversionUtility.IsConvertibleTo<T>(object, bool)
    ConversionUtility.IsConvertibleTo<T>(object, bool)
    Serialization.Serialize(object, bool)
    Serialization.Serialize(object, bool)
    TypeUtility.ToShortString(object, int)
    TypeUtility.ToShortString(object, int)
    UnityObjectUtility.IsUnityNull(object)
    UnityObjectUtility.IsUnityNull(object)
    UnityObjectUtility.ToSafeString(object)
    UnityObjectUtility.ToSafeString(object)
    XAnalyserProvider.Analyser(object, GraphReference)
    XAnalyserProvider.Analyser(object, IGraphContext)
    XAnalyserProvider.Analyser<TAnalyser>(object, GraphReference)
    XAnalyserProvider.Analyser<TAnalyser>(object, IGraphContext)
    XAnalyserProvider.Analysis(object, GraphReference)
    XAnalyserProvider.Analysis(object, IGraphContext)
    XAnalyserProvider.Analysis<TAnalysis>(object, GraphReference)
    XAnalyserProvider.Analysis<TAnalysis>(object, IGraphContext)
    XDescriptorProvider.Describe(object)
    XDescriptorProvider.Description(object)
    XDescriptorProvider.Description<TDescription>(object)
    XDescriptorProvider.Descriptor(object)
    XDescriptorProvider.Descriptor<TDescriptor>(object)
    XDescriptorProvider.HasDescriptor(object)
    Cloning.CloneViaFakeSerialization<T>(T)
    Cloning.CloneViaFakeSerialization<T>(T)
    Cloning.Clone<T>(T, ICloner, bool)
    Cloning.Clone<T>(T, ICloner, bool)
    LinqUtility.Yield<T>(T)
    LinqUtility.Yield<T>(T)
    Serialization.CloneViaSerializationInto<TSource, TDestination>(TSource, ref TDestination, bool)
    Serialization.CloneViaSerializationInto<TSource, TDestination>(TSource, ref TDestination, bool)
    Serialization.CloneViaSerialization<T>(T, bool)
    Serialization.CloneViaSerialization<T>(T, bool)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)