Dialogue System Saver causing issue with storing actor field

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
rjb32
Posts: 5
Joined: Sat Jul 04, 2020 11:46 am

Dialogue System Saver causing issue with storing actor field

Post by rjb32 »

Hello,

I'm experiencing a weird issue that I'm not sure how to resolve.

I have two scenes. On Scene A, I have my Dialogue Manager with the following components recommended by the documentation to add for the saving system: Dialogue System Saver, Save System, PlayerPrefs Saved Game Data Storer, Json Data Serializer, and Standard Scene Transition Manager. Scene B does not have a Dialogue Manager present.

The intended purpose of these two scenes is for the player to interact with an object on Scene A that triggers a conversation. Selecting an option in that conversation calls LoadLevel() and transitions the player to Scene B. Scene B has an "On start" trigger that first calls a custom sequence to adjust some fields in the database's Player actor. This same trigger then plays a conversation. There is then an "on conversation end" trigger that transitions the player back to Scene A. I write to the console on each scene to track the changes.

The issue I'm experiencing is that the player fields I'm adjusting on Scene B do not persist after the transition to Scene A -- they revert back to what they originally were. However, if I disable the Dialogue System Saver component on the Dialogue Manager, the field changes do persist.

I'm not sure if I've done something incorrectly regarding the save system or how to further troubleshoot this issue. Any help or advice would be greatly appreciated.

Thank you!
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System Saver causing issue with storing actor field

Post by Tony Li »

Hi,

After loading a new scene, the save system waits a number of frames before applying save data. This allows scripts that initialize themselves in Start() methods to finish initialization first. You can set the number of frames on the Save System component. By default, it waits 1 frame.

What's happening here is that the "On Start" trigger changes the Dialogue System's data as soon as the scene starts. Then, after a number of frames, the Dialogue System Saver component overwrites the change with the data stored in the save system.

Through DS version 2.2.7, normally you'd change the "On Start" trigger to an "On Use" trigger, and add a Timed Event component to call the trigger's OnUse method after a number of frames.

However, version 2.2.8 adds a new checkbox "Skip Apply Data After Frames If Apply Immediate" to the Dialogue System Saver component. This tells the Dialogue System to immediately restore its data from the save system as soon as the new scene is loaded, and then don't restore it again after a number of frames. It's ticked by default. If you want to use this new checkbox, you can download a patch here:

DS_SaverPatch_2020-07-04.unitypackage

(Version 2.2.8 should be available in the second half of next week.)
rjb32
Posts: 5
Joined: Sat Jul 04, 2020 11:46 am

Re: Dialogue System Saver causing issue with storing actor field

Post by rjb32 »

That explanation was very helpful. I've downloaded the patch and it has fixed my issue.

Thank you!
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System Saver causing issue with storing actor field

Post by Tony Li »

Glad to help! :-)
Post Reply