Page 1 of 1
Adding Saver component to my Player prevents quest from being persisted between scenes
Posted: Tue Aug 11, 2020 3:31 pm
by jlhacode
I just finished implemented a large part of the saving functionality of my test scenes when I realized that my quests aren't being persisted between scene changes anymore.
After a bit of digging through past commits, I found out that the Position Saver component on my player is causing the issue. When it's active, quests don't persist - When it isn't then they do. It doesn't seem to be specific to the Position Saver, as I've replicated the issue with an Enabled Saver on my Player game object as well.
Re: Adding Saver component to my Player prevents quest from being persisted between scenes
Posted: Tue Aug 11, 2020 3:52 pm
by Tony Li
Hi,
Your Player has a Quest Journal component, correct?
If so, make sure the Save Settings section's checkboxes are all ticked, and the Key is the same for the player in both scenes.
Also check that you have a GameObject with a Save System component. This could be the Quest Machine GameObject, or it could be its own GameObject. If you haven't already added DataSerializer and SavedGameDataStorer components to it, add them. (e.g., JsonDataSerializer and PlayerPrefsSavedGameDataStorer.).
If that doesn't help, please feel free to send a
reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look.
Re: Adding Saver component to my Player prevents quest from being persisted between scenes
Posted: Tue Aug 11, 2020 8:13 pm
by jlhacode
Repro project sent!
Re: Adding Saver component to my Player prevents quest from being persisted between scenes
Posted: Tue Aug 11, 2020 9:30 pm
by Tony Li
Hi,
Thanks for sending the repro project.
Assign a unique Key to each Saver component on the Player prefab, including the Quest Journal. For example, set the Quest Journal's Save Settings > Key to "PlayerJournal" and the Position Saver's Key to "PlayerPosition".
The problem was that the Key values on the Quest Journal and Position Saver were both blank. When a Key is blank, it uses the GameObject name. This means the Quest Journal and Position Saver were both saving their data under the same key "Player", causing the Position Saver to overwrite the Quest Journal's data. Alternatively, you can tick each Saver's Append Saver Type To Key checkbox. This will append the saver type name. If you tick this checkbox and leave the Keys blank, the Keys will default to "Player_QuestJournal" and "Player_PositionSaver".
Mostly unrelated note: If you're using TDE to save which scene the player is currently in, you can untick the Save System component's Save Current Scene checkbox.
Re: Adding Saver component to my Player prevents quest from being persisted between scenes
Posted: Tue Aug 11, 2020 10:03 pm
by jlhacode
Hey Tony,
As usual, your solution worked. Thank you so much for your help!
Re: Adding Saver component to my Player prevents quest from being persisted between scenes
Posted: Tue Aug 11, 2020 10:20 pm
by Tony Li
Happy to help!