Interface IElementAdderMenuBuilder<TContext>
Interface for building an IElement
Namespace: Unity.VisualScripting .ReorderableList .Element_Adder_Menu
Assembly: Unity.VisualScripting.Core.Editor.dll
Syntax
public interface IElementAdderMenuBuilder<TContext>
Type Parameters
Name | Description |
---|---|
TContext | Type of the context object that elements can be added to. |
Methods
AddCustomCommand(IElementAdderMenuCommand<TContext>)
Adds a custom command to the menu.
Declaration
void AddCustomCommand(IElementAdderMenuCommand<TContext> command)
Parameters
Type | Name | Description |
---|---|---|
IElement |
command | The custom command. |
Exceptions
Type | Condition |
---|---|
Argument |
If |
AddTypeFilter(Func<Type, bool>)
Adds a filter function which determines whether types can be included or whether they need to be excluded.
Declaration
void AddTypeFilter(Func<Type, bool> typeFilter)
Parameters
Remarks
If a filter function returns a value of false
then that type
will not be included in the menu interface.
Exceptions
Type | Condition |
---|---|
Argument |
If |
GetMenu()
Builds and returns a new IElement
Declaration
IElementAdderMenu GetMenu()
Returns
Type | Description |
---|---|
IElement |
A new IElement |
SetContractType(Type)
Sets contract type of the elements that can be included in the IElementcontractType
will be included in the built menu.
Declaration
void SetContractType(Type contractType)
Parameters
Type | Name | Description |
---|---|---|
Type | contractType | Contract type of addable elements. |
SetElementAdder(IElementAdder<TContext>)
Set the IElement
Declaration
void SetElementAdder(IElementAdder<TContext> elementAdder)
Parameters
Type | Name | Description |
---|---|---|
IElement |
elementAdder | Element adder. |
Remarks
Specify a value of null
for elementAdder
to
prevent the selection of any types.
SetTypeDisplayNameFormatter(Func<Type, string>)
Set the function that formats the display of type names in the user interface.
Declaration
void SetTypeDisplayNameFormatter(Func<Type, string> formatter)
Parameters
Type | Name | Description |
---|---|---|
Func<Type, string> | formatter | Function that formats display name of type; or |
Remarks
Specify a value of null
for formatter
to
assume the default formatting function.