Class UseWithGraphAttribute
Implements
Inherited Members
Namespace: Unity.GraphToolkit.Editor
Assembly: Unity.GraphToolkit.Editor.dll
Syntax
[AttributeUsage(AttributeTargets.Class)]
public class UseWithGraphAttribute : Attribute, _Attribute
Remarks
This attribute links a specific Node class to one or more Graph types, enabling fine-grained control
over which graph types support the node. This allows framework authors to explicitly declare node compatibility across different
kinds of graphs and ensures that only valid nodes are available for use in each graph context.
By default, nodes defined in the same assembly as the graph are considered compatible and available.
In this default setup, the UseWithGraphAttribute is not required.
However, when a graph uses DisableAutoInclusionOfNodesFromGraphAssembly, this attribute must be used to declare which Graph types support the node.
This attribute affects editor behaviors such as graph item library population and helps prevent the accidental use of unsupported nodes.
Constructors
UseWithGraphAttribute(params Type[])
Initializes a new instance of the UseWithGraphAttribute class with the specified supported graph types.
Declaration
public UseWithGraphAttribute(params Type[] graphTypes)
Parameters
Type | Name | Description |
---|---|---|
Type[] | graphTypes | An array of graph types that support the decorated node type. |
Methods
IsGraphTypeSupported(Type)
Determines whether the specified graph type supports the node decorated with this attribute.
Declaration
public bool IsGraphTypeSupported(Type graphType)
Parameters
Type | Name | Description |
---|---|---|
Type | graphType | The type of the graph to validate. |
Returns
Type | Description |
---|---|
bool |
|