Learn how to use NodeCanvas

Download PDF Version

Creating Custom FSM Nodes

While the recomended way of working with FSMs and NodeCanvas in general, is to create Action & Condition Tasks and use those on an Action State for example, it is very possible to create your own FSM States Nodes as an alternative.

To do so you simply have to create a class deriving from FSMState and override the methods as needed, then call Finish() when the state has finished. As soon as you create that class, it will show up to be added in the FSM canvas. You can even specify a custom Icon if you want so. Here is a simple delay State:


That’s it, you now have a custom delay state. Remember that double clicking on a node, opens it up in your IDE!

Finaly, here are some important inherited properties and methods from the FSMState class.

The parent FSM graph of this state.

Component graphAgent
The agent of the FSM.

Blackboard graphBlackboard
The blackboard of the FSM.

float elapsedTime
The time in seconds this state is running.

void Finish()
Call to finish the state.

void SendEvent(string name)
Call to send an event to the FSM graph.

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