A FlowCanvas FlowScript can be used as a FSM State to model the state completely with visual scripting! After you have downloaded the FlowCanvas bridge extension, it will be possible to add such a FlowScript State through the context menu and found under the “SubGraphs” category.
The FlowScript State node inspector has only two specific settings (apart from the FlowScript reference of course and everything else that is commong to subgraphs). Success and Failure Events.
Since FlowScripts can Finish in Success or Failure, an event can optionally be sent to the FSM when this happens. These events are meant to be used by a CheckEvent condition added on the FlowScript State transitions like shown in the example FSM image above.
Using these events is completely optional. If you opt not to use them the FlowScript State will simply call the first ‘OnFinish’ transition as soon as the FlowScript is Finished.
Within the FlowScript, the OnEnable, OnDisable, and OnUpdate events can be used to model the state’s OnEnter, OnExit, and OnUpdate functionality respectively.
The FlowScript Finish node can be used to Finish the state. As explained earlier, when the Finish node is called and considering you have set event names to be used in the FlowScript State node inspector, either the Success or Failure event will be sent to the FlowScript State transitions. If no event names are set, the first OnFinish transition will simply take place.