• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Add persistent data

Umbrella

Refugee
Hello,

I would like to save extra information when a game is saved, and reconstruct it on loading.

Is there an obvious way to do so ? Maybe register a save/load callback to the GameManager, or overload the serialization mecanism ?

Thank you !

EDIT: I noticed cvar get saved, but is it the good way to go if I need a more complex object to persist ?

 
Last edited by a moderator:
Hello,
I would like to save extra information when a game is saved, and reconstruct it on loading.

Is there an obvious way to do so ? Maybe register a save/load callback to the GameManager, or overload the serialization mecanism ?

Thank you !

EDIT: I noticed cvar get saved, but is it the good way to go if I need a more complex object to persist ?
cvar is just a string and a float value. You can get quite clever with them. However, it's stored on a character, so it depends on your usage.

 
Thank you Sphereii !

Reconstructing complex objects from key/values might be tedious, so I was hoping serialization could do the work for me.

As for usage, I was thinking of a more global object. Isn't there always a main character (server owner, map creator ... ) or game object (maybe the bedrock block at (0,0) ) guaranteed to be in game, on which I could attach "global" cvar ?

 
Back
Top