You can save the state of all FSMs of a context or state object by using the Make FSM Snapshot node. All sub-FSMs are considered, recursively. The result is an opaque FSM Snapshot object that you can later use to restore the state.
Restoring FSMs states
You can restore the state of the FSMs that have been saved to a snapshot object, using the Restore FSM Snapshot node. Please bear in mind:
- If an FSM is not running when the snapshot is restored, it will be launched and the state stored in the snapshot is immediately entered (no other blocks in the FSM graph are performed)
- If an FSM is running when the snapshot is restored, the active state is exited and then the state stored in the snapshot is entered (no other blocks in the FSM graph are performed)
In case it’s needed, you can use the Is Restoring FSM Snapshot node to check whether we are in the process of restoring a snapshot for a specific context or state object.
Snapshot objects
Snapshots objects are opaque objects, however, in order to make it possible to serialize the state of the FSMs, convenience blocks to convert a snapshot to/from strings are provided.