Version: Unity 6.7 Alpha (6000.7)
Language : English
Implement context nodes for your graph tool
Implement node options

Implement block nodes for your graph tool

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.

Prerequisites

  1. Implement a graph tool
  2. Implement a context node.

Implement a block node

To implement a block node, define a class to associate the block node with a context node.

  1. Define a class that inherits from the BlockNode base class.
  2. Add the 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.

Additional resources

Implement context nodes for your graph tool
Implement node options