Page 2 of 2

Re: Merging code from different developers

Posted: Fri Sep 23, 2022 2:37 pm
by jmnb
Yes - adding a delay definitely helped, but these quests don't survive to the second scene when I run the project. Please let me know if you have a solution - thanks.

Re: Merging code from different developers

Posted: Fri Sep 23, 2022 3:21 pm
by Tony Li
Is there a reason why you're killing the Dialogue Manager when switching from scene 1 to scene 2? This will dump its state, including quest states and variable values.

If you must do that, remember to add a Dialogue System Saver component to the Dialogue Managers in both scenes, and set the same key for each. (But a different key from any other savers.) The Dialogue System Saver will save the Dialogue Manager's state before leaving scene 1 and then apply it to the Dialogue Manager in scene 2.

Re: Merging code from different developers

Posted: Mon Sep 26, 2022 3:07 am
by jmnb
I had some difficulties with the persistent dialogue manager (I think it was a problem with scene events), so I added a dialogue manager to each scene. But I'll try out these two solutions - thanks.

Re: Merging code from different developers

Posted: Mon Sep 26, 2022 5:19 am
by jmnb
The Dialogue Save System works well with one of the databases, but it doesn't seem to save for both unfortunately. I also added a Save System prefab to scene 1 (set inactive by default), but this doesn't seem to make any difference. Hope you are able to spot the problem!

Re: Merging code from different developers

Posted: Mon Sep 26, 2022 10:56 am
by Tony Li
Hi,

Try this:

1. Remove the SaveSystem component from the EventSystem GameObject.

2. Choose A or B below:

A. It's easiest to keep the Dialogue Manager's Other Settings > Don't Destroy On Load ticked, especially if you're using Extra Databases. In this case:
  • Tick Don't Destroy On Load
  • Add a SaveSystem component to the Dialogue Manager.
  • Remove the inactive SaveSystem GameObject.
B. If you need to use a separate Dialogue Manager in each scene for some reason:
  • UNtick the Dialogue Manager's Don't Destroy On Load.
  • UNtick the Dialogue Manager GameObject's InputDeviceManager component > Singleton.
  • Do NOT add a SaveSystem component.
  • Remove the JsonDataSerializer and PlayerPrefsSavedGameDataStorer.
  • Set the SaveSystem GameObject active. Add JsonDataSerializer and PlayerPrefsSavedGameDataStorer.
The reasons for this boil down to the fact that three components can make a GameObject act as a persistent singleton, which means it survives scene changes and supplants versions that are in subsequently-loaded scenes.
  • DialogueSystemController (when Don't Destroy On Load is ticked, which is the default value)
  • InputDeviceManager (when Singleton is ticked, which is the default value)
  • SaveSystem -- always since it needs to manage scene changes

Re: Merging code from different developers

Posted: Wed Sep 28, 2022 9:00 am
by jmnb
I followed your advice but I still can't get it to work unfortunately. This example shows the problem more clearly - two quests are added in the first scene. Only one is present in the second, and then none are present in the third.

Re: Merging code from different developers

Posted: Wed Sep 28, 2022 10:30 am
by Tony Li
Some unnecessary options are ticked. Inspect your Dialogue Managers GameObjects' DialogueSystemSaver components. Untick Restore State On Start and Skip Apply Data After Frames If Apply Immediate.

Or tick the Dialogue Manager's Don't Destroy On Load checkbox.

Re: Merging code from different developers

Posted: Wed Sep 28, 2022 3:24 pm
by jmnb
Thanks - that fixed it! :D

Re: Merging code from different developers

Posted: Wed Sep 28, 2022 3:44 pm
by Tony Li
Glad to help!