Reply To: Save "state" of FSM graph

NodeCanvas Forums General Discussion Save "state" of FSM graph Reply To: Save "state" of FSM graph

#14884
Gavalakis
Keymaster

Hello there,

This is unfortunately not possible out of the box, but you could create a simplified save system for your agents where you can save the current state name of the agent (FSMOwner.currentRootStateName) and later (after loading the previously saved name), trigger that state directly via FSMOwner.TriggerState(string stateName).

As for saving the duration the agent has been on a state that would be far more complex and would require a lot of custom code. Are you certain you have to save the duration the fsm state has been running?

For your information, please note that you can save and load blackboard variables which can also prove to be useful in certain cases. You can save and load a blackboard variables via the Blackboard.Save and Blackboard.Load methods (which is a simplified version which saves to PlayerPrefs by a provided string ‘key’, or for a more manual approach, by utilizing the Blackboard.Serialize and Blackboard.Deserialize methods, which will return the serialized json string (from Serialize method), which will then have to be provided for loading (in Deserialize method).

Let me know.

Thanks 🙂

Join us on Discord: https://discord.gg/97q2Rjh