Class ElementAdderMenuCommandAttribute | Bolt Visual Scripting | 1.4.12
docs.unity3d.com
    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
    Namespace: Ludiq.ReorderableList.Element_Adder_Menu
    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

    Extension Methods

    XDescriptorProvider.Descriptor(Object)
    XDescriptorProvider.Descriptor<TDescriptor>(Object)
    LiteralUtility.ToLiteralString(Object)
    LiteralUtility.ToLiteralStringOrDefault(Object)
    LiteralUtility.TryToLiteralString(Object, out String)
    XFilterProvider.Filter(Object)
    XFilterProvider.Filter<TFilter>(Object)
    Cloning.Clone(Object, ICloner, Boolean)
    Cloning.Clone(Object, ICloner, Boolean, out Dictionary<Object, Object>)
    Cloning.Clone<T>(T, ICloner, Boolean)
    Cloning.Clone<T>(T, ICloner, Boolean, out Dictionary<Object, Object>)
    Cloning.CloneViaSerializationPolicy(Object)
    Cloning.CloneViaSerializationPolicy(Object, out Dictionary<Object, Object>)
    Cloning.CloneViaSerializationPolicy<T>(T)
    Cloning.CloneViaSerializationPolicy<T>(T, out Dictionary<Object, Object>)
    Cloning.CloneInto(Object, ref Object, ICloner, Boolean)
    Cloning.CloneInto(Object, ref Object, ICloner, Boolean, out Dictionary<Object, Object>)
    Cloning.CloneInto<T>(T, ref Object, ICloner, Boolean)
    Cloning.CloneInto<T>(T, ref Object, ICloner, Boolean, out Dictionary<Object, Object>)
    Cloning.CloneIntoViaSerializationPolicy(Object, ref Object)
    Cloning.CloneIntoViaSerializationPolicy(Object, ref Object, out Dictionary<Object, Object>)
    Cloning.CloneIntoViaSerializationPolicy<T>(T, ref Object)
    Cloning.CloneIntoViaSerializationPolicy<T>(T, ref Object, out Dictionary<Object, Object>)
    Cloning.CloneValueType(Object)
    ConversionUtility.ConvertTo<TSource>(TSource, Type)
    ConversionUtility.IsLateConvertibleTo(Object, Type, Boolean)
    ConversionUtility.IsLateConvertibleTo<T>(Object, Boolean)
    ConversionUtility.LateConvertTo(Object, Type)
    ConversionUtility.LateConvertTo<T>(Object)
    ConversionUtility.TryLateConvertTo(Object, Type, out Object, Boolean)
    ConversionUtility.TryLateConvertTo<T>(Object, out T, Boolean)
    TypeUtility.ToShortString(Object, Int32)
    TypeUtility.CastTo<T>(Object)
    Serialization.FullSerialize(Object, Boolean)
    Serialization.OdinSerialize<T>(T, DataFormat)
    Serialization.OdinSerialize<T>(T, ref OdinSerializer.SerializationData, DataFormat)
    LinqUtility.Yield<T>(T)
    UnityObjectUtility.IsUnityNull(Object)
    UnityObjectUtility.UnityNullCoalesce(Object, Object)
    UnityObjectUtility.ToSafeString(Object)
    BoltGenerationUtility.GenerateLiteral(Object, IGeneration)
    XGeneratorProvider.Generator(Object, IGeneration)
    XGeneratorProvider.Generator<TGenerator>(Object, IGeneration)
    XGeneratorProvider.HasGenerator(Object, IGeneration)
    XGeneratorProvider.HasGenerator<TGenerator>(Object, IGeneration)
    XGeneratorProvider.TryGetGenerator(Object, out IGenerator, IGeneration)
    XGeneratorProvider.TryGetGenerator<TGenerator>(Object, IGeneration, out TGenerator)
    HybridConversionUtility.ConvertTo(Object, HybridType, HybridType)
    HybridConversionUtility.IsLateConvertibleTo(Object, HybridType, Boolean)
    HybridConversionUtility.LateConvertTo(Object, HybridType)
    HybridConversionUtility.TryLateConvertTo(Object, HybridType, out Object, Boolean)
    HybridTypeUtility.GetHybridType(Object)
    IsUtility.Is<TO, TC>(TO, out TC)
    PrivateReflectionUsingDynamicExtensions.AsDynamic(Object)
    JsonWriter.ToJson(Object)
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX