Version: Unity 6.5 Alpha (6000.5)
Language : English
Implement nodes for your graph tool
Implement block nodes for your graph tool

Implement context nodes for your graph tool

Create context nodes to organize and contain block nodes in the graph tool.

Context nodes provide context-specific information or functionality and contain only block nodes. A context node inherits all features available in its parent Node class.

This page covers how to implement context nodes only. For information on how to implement block nodes, refer to Implement block nodes for your graph tool. For information about node types, refer to About nodes.

Prerequisites

  1. Set up the code structure.
  2. Implement a graph tool.

Implement and instantiate a context node

To implement a node, define a class and instantiate the node in your graph.

Define a class

To implement a context node, define a class that inherits from the ContextNode base class:


[Serializable]
public class MyContextNode : ContextNode
{
}

Review Implement a node to learn how to customize the node with node options, ports, and orientation settings.

Instantiate a context node in your graph

To add a context node to the graph:

  1. Right-click on the graph canvas, and select Add Node to open the Add a graph node window.
  2. Navigate to the Contexts category.
  3. Double-click to add the context node to the graph.

The context node appears on the canvas. It behaves like any other node in the graph. You can move it, disable it, remove it, or connect it to other nodes or variables.

A new context node doesn’t contain any blocks. Follow the steps in Implement block nodes for your graph tool to add blocks to the context node.

Additional resources

Implement nodes for your graph tool
Implement block nodes for your graph tool