I'm using PersistentDataManager.ApplySaveData(dialogueSystemData-string) to load my data, and it all works fine, except if I add new Quests and then load a save from before the quests were added. I can't add a Watch for the new quest, and the quest doesn't work despite my calling QuestLog.SetQuestState() to make it Grantable.
Not sure exactly where the problem is. Is there a way to sync/add newly added things, or keep the extra data, when calling PersistentDataManager.ApplySaveData()?
We're on version 2.2.9
PersistentDataManager.ApplySaveData() removes newly added Quests from new database
PersistentDataManager.ApplySaveData() removes newly added Quests from new database
Last edited by Ultroman on Wed Mar 15, 2023 12:05 pm, edited 1 time in total.
Re: PersistentDataManager.ApplySaveData() removes newly added Quests from new database
Hi,
Inspect the Dialogue Manager GameObject, and tick Persistent Data Settings > Initialize New Variables. Despite the name, it also initializes new quests that were added since the saved game file was made.
Inspect the Dialogue Manager GameObject, and tick Persistent Data Settings > Initialize New Variables. Despite the name, it also initializes new quests that were added since the saved game file was made.
Re: PersistentDataManager.ApplySaveData() removes newly added Quests from new database
Dude, 2 minutes! You are ON IT! <3
Sadly, that option is already ticked.
Sadly, that option is already ticked.
Re: PersistentDataManager.ApplySaveData() removes newly added Quests from new database
Is there anything else I can check for? Is there a sync-method I can call or something?
Re: PersistentDataManager.ApplySaveData() removes newly added Quests from new database
We'll need to get more info.
What version of the Dialogue System are you using?
Are there any errors or warnings in the Console window when you call PersistentDataManager.ApplySaveData()?
As a temporary test, edit PersistentDataManager.cs. Locate the "Lua.Run" line in the InitializeNewQuestEntriesFromDatabase() method, which is on line 1437 in version 2.2.34. Change it from this:
to this:
Then reproduce the issue. You should see a line in the Console that starts similarly to:
Dialogue System: Lua(Item["Quest Name"] = {..
This will give you an idea of which new quests it's initializing because they weren't in the original save data.
What version of the Dialogue System are you using?
Are there any errors or warnings in the Console window when you call PersistentDataManager.ApplySaveData()?
As a temporary test, edit PersistentDataManager.cs. Locate the "Lua.Run" line in the InitializeNewQuestEntriesFromDatabase() method, which is on line 1437 in version 2.2.34. Change it from this:
Code: Select all
Lua.Run(luaCode);
Code: Select all
Lua.Run(luaCode, true);
Dialogue System: Lua(Item["Quest Name"] = {..
This will give you an idea of which new quests it's initializing because they weren't in the original save data.
Re: PersistentDataManager.ApplySaveData() removes newly added Quests from new database
We're using DS version 2.2.9 and Unity 2021.3.16f1.
After an hour of trying to debug PersistentDataManager with no errors being shown, it suddenly started working, and I could confirm that it already had the new quests and their entries in its database, so it didn't need to add anything (it does seem a bit "scary" with the conditions for diff-checks being that the number of entries must be higher; what if one was removed and/or another added?).
So, it works. BUT, I still can't add a Watch for the new quests after calling PersistentDataManager.ApplySaveData() with the old data. I can add a Watch for them before I load, and then refresh it after loading, and that works fine.
After an hour of trying to debug PersistentDataManager with no errors being shown, it suddenly started working, and I could confirm that it already had the new quests and their entries in its database, so it didn't need to add anything (it does seem a bit "scary" with the conditions for diff-checks being that the number of entries must be higher; what if one was removed and/or another added?).
So, it works. BUT, I still can't add a Watch for the new quests after calling PersistentDataManager.ApplySaveData() with the old data. I can add a Watch for them before I load, and then refresh it after loading, and that works fine.
Re: PersistentDataManager.ApplySaveData() removes newly added Quests from new database
I'll look into the Watches issue.
If you can back up your project, make sure your backup is good, and then update to the current DS version, I would recommend that. Make sure to read the release notes, too.
If you can back up your project, make sure your backup is good, and then update to the current DS version, I would recommend that. Make sure to read the release notes, too.
Re: PersistentDataManager.ApplySaveData() removes newly added Quests from new database
Thank you very much! We'll update as soon as we can.