The title says it. I want the client to have a WHOLE copy of a save game object on the server (instead of passing variables one by one, because I might add some later). But when I try to send it trough an event called on client, the save game object - certainly because it’s only a reference - is invalid and I can’t save it. Is there a way to achieve this ?
You answered your own question. It’s a reference to a transient piece of memory. Even if you save a client-side version of the reference, the object it’s referencing will no longer exist when you re-load the game. You’ll need to serialize the data you want to save, and recreate the object from it at runtime.
Okay, thank you. Do you know any way toi achieve easily for a save game object ? My issue is that the save game is not yet stabilized, I will modify it later and it would be very annoying to change this everytime.
Certainly, but that doesn’t solve the problem or at least it remains quite tiring to modify this function as soon as I change something in the savegame. I’m lazy.
Sorry for the late reply. In all honesty, my best advice is to simply wait on the save system. Trying to develop it in parallel with your gameplay slows down your iteration time unnecessarily. If there’s something that you absolutely need to save, go for it, but I wouldn’t tackle the majority of the save system until things are closer to final.