Merging code from different developers

Announcements, support questions, and discussion for the Dialogue System.
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Merging code from different developers

Post 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.
Attachments
updated.zip
(7.38 KiB) Downloaded 21 times
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Merging code from different developers

Post 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.
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Merging code from different developers

Post 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.
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Merging code from different developers

Post 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!
Attachments
updated2.zip
(13.75 KiB) Downloaded 25 times
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Merging code from different developers

Post 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
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Merging code from different developers

Post 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.
Attachments
updated3.zip
(7.72 KiB) Downloaded 25 times
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Merging code from different developers

Post 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.
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Merging code from different developers

Post by jmnb »

Thanks - that fixed it! :D
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Merging code from different developers

Post by Tony Li »

Glad to help!
Post Reply