In order to create any additional functionality, that is not achievable within PaleBlue Trainer and Flow, you can create a custom node.
A custom node is a piece of C# code wrapped in a Flow Node, so that it can be invoked within the execution of our flow. Within this node, you can perform any action with scene and objects, and also call external APIs.
Making a custom node will require a bit of coding knowledge, but nothing really advanced.
To start, create a new script in your project.
Now, depending on what you want the node to do, there are 2 base classes that can be expanded and used: Basic Node and Generic Group Action Node.
Basic Node
This is a simple node that will execute a simple function and continue with the flow.
Opening Flow in your scene, you can now add your node to Flow and use it:
You can extend this node, by additional flow outputs, value inputs and outputs. Thatâs more or less the extend of the Basic Node.
In case you want to create a node that works with several objects a certain type (group actions, selections, showing and hiding etc.), you might want to use the Generic Group Action Node instead.
Generic Group Action Node
This node can process a list of objects of a certain kind. Youâve seen these nodes: they work on group of objects to e.g. show&hide them, allow to select them, and so on.
To start, weâneed to understand what type of objects (object class) it will work with. It can be just GameObject, if youâre working with generic list of any scene objects.
Take a look at the following. It is a node that allows specifying a list of GameObjects in its configuration, and then will print out objectsâ names when executed in runtime:
A couple of things to note here:
- For every object on the list, RegisterSelection() is called on node execution.
- Once the node execution is done, UnregisterSelection() will be called. Register and Unregister methods can be used to perform any kind of actions on the objects.
- You can alternatively use HandleInInternal() method. It allows you to do something when the node is executed. In this method, you can use _actualObjects list that holds all of the objects.
With the above code, an additional Node will be available in your Flow:
As noted, this node will work as any other selection or group node.