Version: Unity 6.4 (6000.4)
Language : English
Implement a graph tool
Implement nodes for your graph tool

About nodes

Understand nodes, their parts, and the different types of nodes.

In the context of graph tools, a node is a modular building block that represents a specific operation, piece of data, or functionality. Nodes are visual elementsA node of a visual tree that instantiates or derives from the C# VisualElement class. You can style the look, define the behaviour, and display it on screen as part of the UI. More info
See in Glossary
that can connect together to define workflows, processes, or systems. Each node typically has inputs, outputs, and internal logic that determines how it processes information.

Think of nodes as puzzle pieces or blocks in a construction set. Each node serves a specific purpose. When combined with other nodes, they create a larger, more complex structure or tool.

This page covers node concepts only. For information on how to implement a node, refer to Implement nodes for your graph tool. For information about node options, refer to Implement node options.

Types of nodes

Graph Toolkit supports three primary types of nodes, each of which serves a distinct purpose within a graph tool:

  • Standard node: The basic building block of a graph. It represents an individual operation or data point. Standard nodes can have input and output ports to connect with other nodes.
  • Context node: A node that provides context-specific information or functionality. It’s a specialized container that contains only block nodes that define its operation.
  • Block node: A node that exists only in a context node and performs a single operation.

Secondary nodes provide a function that can’t be modified. These nodes include:

  • Variable nodes: Represent a variable in the blackboard.
  • Constant nodes: Represent a local constant value.
  • Portal nodes: Pass a wire connection from one node to another.

Note: Graph Toolkit doesn’t have any predefined nodes. Instead, there’s an API, so you can build your own nodes with their own logic to meet the needs of your application.

Anatomy of a node

In the user interface, a node has these parts:

  • Header: The icon, the title, and the Collapse Node button. The Collapse Node button only appears when you position the mouse over the node.
  • (Optional) Options panel: General settings that affect the entire node.
  • (Optional) Input/output ports: Connection points for the node.

Context nodes

Context nodes act as specialized containers that dynamically organize related functional components known as block nodes. You can add, remove, and reorder these blocks within a cohesive structure. With context nodes, you can configure settings that apply to all contained blocks and control which blocks each context node can accept.

Put block nodes in a context node when:

  • Multiple operations logically belong together.
  • Operations need to follow a specific execution order.
  • Multiple operations require the same parameters.
  • You need to restrict operations users can perform in a section.
  • Complex logic must be broken down into manageable segments.

Context node structure

In the user interface, a context node has these parts:

  • Header: Title and icon of the context node.
  • Blocks container: Houses block nodes and the Add a Block button.
  • (Optional) Options panel: General settings that affect the entire context.
  • (Optional) Input/output ports: Connection points for the context node.

Block nodes

Block nodes are nodes that exist exclusively within context nodes. They’re responsible for performing a single operation or behavior. Unlike standard nodes, a block node can only exist within a context node, and you can’t add it to the graph directly.

Each block type works with specific context node types and can take inputs, produce outputs, and participate in the execution flow defined by its parent context.

Note: Graph Toolkit doesn’t enforce a specific execution order. Instead, it displays visual indicators, known as etches, between blocks.

You can drag a block node to rearrange it within the context node or move it to another compatible context node. You can’t add an incompatible block node to a context node. If you try to drag an incompatible block to a context node, the context node displays a red outline, and the incompatible block returns to its original position.

Block node structure

In the user interface, a block node has these parts:

  • Header: Block title.
  • Etch: Visual indicator between blocks.
  • (Optional) Options panel: Block-specific settings.
  • (Optional) Input/output ports: Connection points specific to this block.

Additional resources

Implement a graph tool
Implement nodes for your graph tool