Reply To: How to save/load graph in game at run time.

NodeCanvas Forums General Discussion How to save/load graph in game at run time. Reply To: How to save/load graph in game at run time.

#8810

Hello,

I am looking for a bit of clarification on the Serialization/Deserialization of graphs here. What does Graph.Deserialize() do?
– does it create a brand new graph from the connections/node in the JSON string?
– or does it *update* the current graph from the JSON data (like current state, elapsed time on all the nodes)?

Basically, I’m wondering how to save/restore the *state* of a *running* graph during play. For instance, let say the current node has a Wait on it with 0.2s left on a 1s timer (Wait time = 1s with 0.8s on the elapsed time). On restore, the graph needs to set the active node to the one with Wait action (if it is not the Start node) and set the elapsed time on it.

Clearly, this is a simple example, more complex actions can have more advanced internal state.

Cheers,
Alain-Daniel