Adding Saver component to my Player prevents quest from being persisted between scenes

Announcements, support questions, and discussion for Quest Machine.
Post Reply
jlhacode
Posts: 77
Joined: Fri Jul 03, 2020 6:23 am

Adding Saver component to my Player prevents quest from being persisted between scenes

Post 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.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding Saver component to my Player prevents quest from being persisted between scenes

Post 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.
jlhacode
Posts: 77
Joined: Fri Jul 03, 2020 6:23 am

Re: Adding Saver component to my Player prevents quest from being persisted between scenes

Post by jlhacode »

Repro project sent!
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding Saver component to my Player prevents quest from being persisted between scenes

Post 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.
jlhacode
Posts: 77
Joined: Fri Jul 03, 2020 6:23 am

Re: Adding Saver component to my Player prevents quest from being persisted between scenes

Post by jlhacode »

Hey Tony,

As usual, your solution worked. Thank you so much for your help!
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding Saver component to my Player prevents quest from being persisted between scenes

Post by Tony Li »

Happy to help! :-)
Post Reply