Create block nodes to define the functionality of the context nodes of your graph tool in Unity.
Block nodes are nodes that perform a single operation or behavior. Block nodes inherit all features available in their parent Node class.
Note: Block node ports are always horizontal and, as such, the AsVertical method has no effect.
This page covers how to implement block nodes only. For information on how to implement context nodes, refer to Implement context nodes for your graph tool. For information about node types, refer to About nodes.
To implement a block node, define a class to associate the block node with a context node.
BlockNode base class.UseWithContext attribute, and provide it with the type of the ContextNode to associate the block node with.The resulting code looks like:
[UseWithContext(typeof(MyContextNode))]
[Serializable]
public class MyBlockNode : BlockNode
{
}
[UseWithContext(typeof(MyContextNode), typeof(MyOtherContextNode))]
[Serializable]
public class MyBlockNodeWithMultipleContexts : BlockNode
{
}
To associate a block node with several context nodes, list them separated with a comma in your UseWithContext attribute:
[UseWithContext(typeof(MyContextNode), typeof(MyOtherContextNode))]
[Serializable]
public class MyBlockNodeWithMultipleContexts : BlockNode
{
}
Review Implement node options to learn how to customize your node with node options, ports, and orientation settings.