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.
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, and instantiate the node.
To implement a block 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.
To add a block node inside a context node:
In the context node, select Add a Block. The Add a graph node window opens and displays all the blocks you can add to the context node.
To add a block node to the context node, double-click the block node.
After you add it, you can disable, remove or connect a block node the same way as other nodes.