Hi there,
The example you've given shouldn't throw an error (not from our end anyway). In the case of loading your data it will load value1 as expected and do nothing with value2.
In this case you would need to set an appropriate default value for your value2 field.
If you want to perform logic based on version number then you would simply check your version number field and perform logic accordingly. There's no way of Easy Save to automatically know what logic you would want to perform.
Just a note, generally you would put your version number in a seperate key in your file, rather than putting it in the script itself. This means you can access the version number before loading the data. You also don't need different version numbers for each iteration of your script, just a version number for each build. E.g.
Code: Select all
// To save
ES3.Save("version", Application.version);
// To load
var version = ES3.Load<string>("version", null);
if(version == null)
{
// This would be your last version before adding version numbers. So we can load normally.
gameData = ES3.Load<Gamedata>("gameData");
}
else if(version == "1.1")
{
// This would be your last version before adding version numbers. So we can load normally.
gameData = ES3.Load<Gamedata>("gameData");
}
else if(version == "1.2")
{
// etc
}
All the best,
Joel