Download

Casting a Modified Save Data Class

I’m running into an issue where after patching a live game, save data is proving unreliable, that most cardinal of sins. This is most likely because part of the save data is “game settings”, which basically includes choices the player made when spinning up a game. These settings are stored in a GameSettings struct, and I added a new variable to the struct as of this version; so I suspect that: a.) the class would cast fine and would assign the default value to any new fields added, except that b.) it can’t handle doing that with a struct that has a new variable.

Assuming that’s the case, what I probably need to do is keep my original struct intact (i.e. without that new variable), move that portion of the saved data into individual fields for future saving safety, and migrate saved data coming out of the older version.

I’m curious how others have handled this and also asking whether part a.) above is true. If I add fields to my SaveGame class, will it be able to cast in the future, or will any added field cause a cast mismatch and I need a new SaveGame class each time I update that data (or an entirely different More Preferable Option C)?

Also, this was all done in a custom 4.14 originally, but I’ve just updated everything to a custom 4.16; I think I recall reading that blueprints have access to maps now? That seems like possibly the nicest and safest route.