Custom Node

Nodes are the most important parts of TALK. During development, you may want to create new nodes to expand the functionality of the asset.

To create a new Node right-click on the Project Panel inside the Unity Editor and navigate to Create → TALK → Developer , choose the node type you want to create and give the text file created a suitable name.

Node type

Simple Node

This node can have a process its input and return the result as output. It can't have a port for execution edge.

Executable Node

These nodes are connected together by an execution edge. Beginning from the Start node the system goes through these lines to complete the graph. An executable node can have multiple inputs and outputs and can pause the execution flow as long as it needs.

Content Node

These nodes are special Executable Nodes that are accepted by a Content Stack. Unlike the previous node type, these don't require any execution port, instead, the output stack executes them from top to bottom.

Inputs & Outputs

Adding input and output ports to the node is simple. Create a public or serialized variable of any type and use the Input or the Output attribute. These attributes have two parameters: the name which will be used to display the label beside the port and if it allows multiple input connection.

[Input(name = "In", allowMultiple = false)] public float input;

[Output(name = "Out", allowMultiple = false)] public float	output;

Parameters

Every public and serialized variable that doesn't use the Input or Output attribute will appear in the node as a parameter.

Processing

Every node can override the Process method, which is called when the system enters that node.

protected override void Process()
{
    // Here comes the node logic
}

Execution Flow

The execution flow goes through input and output ports of a special type: ExecutionLink.

After entering the node and processing it, the system asks the node how to continue. ExecutableNodes have their default implementations, returning the first ExecutionLink output. If your node has multiple outputs, you have to write your custom logic.

In the case of Content Nodes, these types of inputs and outputs are not required. Typically the execution flow goes from top to bottom in the Content Stack.

Wait before continue

You can pause the execution flow by setting the isWaiting property. While this property returns true, the execution flow won't continue. Content Stack still processes all its nodes, but won't exit through an ExecutionLink.

Custom Node View

To create a new Node right-click on the Project Panel inside the Unity Editor and navigate to Create → TALK → Developer → Node View Scriptand give the text file created a suitable name.

The NodeCustomEditor allow you to override the default inspector of the nodes and gives you access to the containers of the Node class plus some other useful elements, such as controlsContainer which is the body of the node and debugContainer for debug.

Style

Currently, the only thing you can change about style is the color of the ports (and so their links). You can define custom port colors to use per field type in a file named PortViewTypes.uss in a Resources folder.

Debug

When you create a custom view for your nodes, you can add debug information into the debugContainer like so:

Then it can be displayed by toggling the Debug option in the context menu of the node:

Last updated

Was this helpful?