I’ve created a custom class to store my save data, which I’m then serializing to a file on save. This all works well and good, I can deserialize the file when I load it up and I get all the values right where they belong.
However, I run into an issue when I add additional values to my custom class, resulting in the loaded file populating any new values as null, instead of the default values I have set for them.
I’m wondering if there’s an elegant way to either prevent the load from overriding existing values with null (I still want it to override existing values if the load is putting a new value there). Or if there’s a way to clone my class to a new instance and weed out the nulls during that exchange.
For reference, I’m using the SaveLoad method detailed in this blog