The Village Framework provides a base to save its content as a json object, and be reloaded from it.
You can use the function JSONObject.AddDatabaseItem<TItem>(key, value) to add a database item to a jsonObject.
This will save either the ID , or the string “null” if no item is found.
Upon deserialization, use JSONObject.TryGetDatabaseItem<TItem>(key, out item) to get it back. The deserialization will try to get the id, and then try to load the resource from it. If the string is null, or no object is found, returns false.
On the villageManager, call Serialize(jsonObject) to save it. Call Deserialize(jsonObject) to load it. Make sure the Village was initialized before loading.
It will save its current date, chapter, and all days generated.
Then save the seed, which contains the random count (see Village Generation for info on randomization)
Then, for each component attached, it will try to serialize it, and add it to its content object.
When creating new variation of a manager, or a new manager, make sure to override Serialize()and Deserialize().
Before saving, call VillageManager.PreSave(). It will call the function PreSaveGame() on all components, where you can add behavior to check for missing values before serialization.
After a load, a similar function is VillageManager.PostLoad(), calling PostLoad() on all components.