Hi Alfonso,
The save system saves the Lua environment. When you load an extra database, it adds its data to the Lua environment. When you unload the database, it removes its data from the Lua environment.
Since the save system saves the Lua environment, it saves the runtime data of all loaded databases.
Many people who use multiple databases use a main database that's always loaded (and assigned to the Dialogue Manager's Initial Database field). This contains "global" information that you always want to include in saved games.
Then they load and unload other databases as they move between chapters, villages, planets, etc. These other databases contain data that's only used in that chapter or location and don't need to remember anything when leaving. If you need to remember something -- for example, a choice the player made on another planet -- put that data in the main database.
If you really need to save only one database, you could try this:
1. Save the entire Lua environment:
Code: Select all
string allData = PersistentDataManager.GetSaveData();
2. Remove all the other databases:
Code: Select all
DialogueManager.RemoveDatabase(someDatabase); // Repeat for all databases except the one to save.
3. Get the Lua environment:
Code: Select all
string data = PersistentDataManager.GetSaveData();
4. Add the other databases back, and restore the data:
Code: Select all
DialogueManager.AddDatabase(someDatabase); // Repeat for all.
PersistentDataManager.ApplySaveData(allData);
The saved data for your one database will be in the
data variable.
But, given the way that the Dialogue System works, you probably don't want to save it like this.