Page 1 of 1

Supporting save files for older versions of a game

Posted: Fri Mar 27, 2020 2:08 pm
by FredTuna
Hi,

we are slowly approaching launch for our game and wondering what the best approach is to support save files of previous versions of our game when end up pushing updates.
So let's say we have version 1.0 of our game launch. Our players save their game. Then they download an update to the game that we pushed. I have to make sure their previous save files still work.

The problem I have encountered is if prefabs with an ES3Prefab component have been modified in such a way that some references in ES3Prefab were removed. Saved prefab instances in older save files will try to access those references which will break the load process.

Is the solution to then never modify ES3Prefabs in a way that would remove references? What is the prefered strategy here?

A similar issue exists with the fields saved in ES3Types_**. My plan was to never remove fields or properties that were saved so that if you load a previous save file, it won't fail because it can't find a field or property in a given class. Another approach could be to gracefully handle cases where the field or property isn't found when loading.

Any help is appreciated! Thanks!

Re: Supporting save files for older versions of a game

Posted: Sat Mar 28, 2020 9:33 am
by Joel
Hi there,

With regards to references and fields being removed, both of these cases should be handled gracefully. Would you be able to let me know more about the errors you're getting which are stopping the save process so I can look into this further?

All the best,
Joel

Re: Supporting save files for older versions of a game

Posted: Tue Mar 31, 2020 12:16 am
by FredTuna
Usually what happens is that let's say I save a game session. Then I remove a component from a game object in an ES3Prefab. Then run another game session and load the previous save file. When it finds the ES3Prefab in the save file, it will instantiate the modified ES3Prefab. Then when it reads the component that was removed, it will not find the reference id for that component and it will instead try to Add the component which will call Awake without some serialized fields being set and throw an exception and fail the load sequence.

For the fields, I just need to modify the ES3Type file so it doesn't try to set a value on a private field or property that was removed.

Re: Supporting save files for older versions of a game

Posted: Wed Apr 01, 2020 7:54 am
by Joel
HI there,

It would not be possible for the serialiser to tell whether the Component was deleted, or whether it was a Component added at runtime. Generally in this case you would disable the Component, rather than deleting it entirely. However, because you are using Awake(), this will not stop that from being called.

If you private message me your invoice number, I'm happy to send over and update which stops Components from being added when they don't exist.

All the best,
Joel