Learn how to use FlowCanvas

Download PDF Version

Creating Full Nodes

Creating full flow nodes can be a bit more hard to understand, but you get full access to everything and can create any type of node you want, like for example new Events, Flow Controllers or anything else, although I personaly recommend going this way for Events and Flow Controllers only.

Let’s take an example of re-creating a FlowController node, the “SwitchBool”, which practicaly is an if-then-else statement. To do so, create a class and derive from “FlowControlNode”, then you must override the RegisterPorts method and register the ports within.

Registering the ports is done by using the following methods:

FlowInput : AddFlowInput(string name, Action pointer)
name: The name of the port.
pointer: A delegate that will be called once this flow input is called.

FlowOutput: AddFlowOutput(string name)
: The name of the port.
To execute the port, you have to call, Call() on the FlowOutput object returned, along with the current Flow object received.

ValueInput<T> : AddValueInput<T>(string name)
: The name of the port.
To get the value connected to the port, you simply do so by calling the .value property of the object returned.

ValueOutput<T> : AddValueOutput<T>(string name, Func<T> getter)
: The name of the port.
getter: A delegate that will be called to get the value of type T.

In practice it’s easier than it sounds…

As you see above, there are a number of attributes you can use for specifying the name if it needs to be different than the class name, as well as attributes for the node’s category and help description.

Yes No Suggest edit
2 of 2 users found this section helpful
Suggest Edit