Dialogue System not running between scene changes

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
neohazardous
Posts: 7
Joined: Mon Sep 28, 2020 11:38 am

Dialogue System not running between scene changes

Post by neohazardous »

Just like the title says, I'm having issues with the dialogue system running when Unity changes between scenes. I am currently using Unity's SceneManager.LoadScene() function to get the job done. If I play the scenes individually in the editor, the dialogue runs just fine. When the scene switches in both the editor and the build, the dialogue systems do not run. Currently, the dialogues are set to run OnStart, with other dialogues being run when certain actions are completed by the player.

Can I please have some insight into what may be going wrong? Thanks for your time and help!
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System not running between scene changes

Post by Tony Li »

Hi,

On the Dialogue Manager, are the Other Settings > Don't Destroy On Load and Allow Only One Instance checkboxes still ticked?

Are there any warnings or error messages in the Console window?

Side note: You may want to eventually change scenes using PixelCrushers.SaveSystem.LoadScene() instead of SceneManager.LoadScene(). This allows the Dialogue System's save system to tie into the scene change process. (See Save System for more info.)
neohazardous
Posts: 7
Joined: Mon Sep 28, 2020 11:38 am

Re: Dialogue System not running between scene changes

Post by neohazardous »

Tony Li wrote: Mon Oct 19, 2020 3:48 pm Hi,

On the Dialogue Manager, are the Other Settings > Don't Destroy On Load and Allow Only One Instance checkboxes still ticked?

Are there any warnings or error messages in the Console window?

Side note: You may want to eventually change scenes using PixelCrushers.SaveSystem.LoadScene() instead of SceneManager.LoadScene(). This allows the Dialogue System's save system to tie into the scene change process. (See Save System for more info.)
They are still ticked. I tried seeing if unticking them would make any changes as well and had the same results. As for errors, these are the messages that appear in the console when the next scene is loaded. I don't know what the issue is with Conversation "Level Intro" not found in database, since it still exists in the database that is being used for that scene.

https://drive.google.com/file/d/1PCBGw_ ... sp=sharing

Edit: Realizes the photo was not appearing in the message
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System not running between scene changes

Post by Tony Li »

Hi,

The Dialogue Manager survives scene changes. When it arrives in a new scene, it replaces any Dialogue Manager that was in that scene at design time.

It's simplest to put all of your conversations into a single database, and assign that database to the Dialogue Manager in every scene. See: Working With Multiple Databases for more info. If you have more than one database right now, you can use the Dialogue Editor window's Database tab to merge the contents of one database into another.

Here's the consideration with multiple databases:

Let's say you have Scene A with a Dialogue Manager A pointing to Database 1.

Scene B has a Dialogue Manager B pointing to Database 2.

When you play Scene A and then change to Scene B, Dialogue Manager A will survive the scene change and replace Dialogue Manager B. This means that Database 1 will be in memory, not Database 2.

If you must have two databases, add an Extra Databases component to Scene B. Assign Database 2 there. Note that you will want to run the Unique ID Tool to ensure that internal IDs are unique across Database 1 and Database 2. (See that Working With Multiple Databases link above.)
neohazardous
Posts: 7
Joined: Mon Sep 28, 2020 11:38 am

Re: Dialogue System not running between scene changes

Post by neohazardous »

Tony Li wrote: Mon Oct 19, 2020 4:21 pm Hi,

The Dialogue Manager survives scene changes. When it arrives in a new scene, it replaces any Dialogue Manager that was in that scene at design time.

It's simplest to put all of your conversations into a single database, and assign that database to the Dialogue Manager in every scene. See: Working With Multiple Databases for more info. If you have more than one database right now, you can use the Dialogue Editor window's Database tab to merge the contents of one database into another.

Here's the consideration with multiple databases:

Let's say you have Scene A with a Dialogue Manager A pointing to Database 1.

Scene B has a Dialogue Manager B pointing to Database 2.

When you play Scene A and then change to Scene B, Dialogue Manager A will survive the scene change and replace Dialogue Manager B. This means that Database 1 will be in memory, not Database 2.

If you must have two databases, add an Extra Databases component to Scene B. Assign Database 2 there. Note that you will want to run the Unique ID Tool to ensure that internal IDs are unique across Database 1 and Database 2. (See that Working With Multiple Databases link above.)
So just to make sure I am understanding the instructions properly, do I remove the dialogue managers from the other scenes? I currently have a dialogue manager and a "dialogue spawn" game object that exists for being the location in which conversations and barks instantiate at. Would I have to remove the dialogue spawn game object as well?
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System not running between scene changes

Post by Tony Li »

You technically only need a Dialogue Manager in the first scene, since it will survive scene changes.

However, you can have a Dialogue Manager in each scene. It makes it much easier to playtest individual scenes in the editor. Just keep in mind that when you're changing scenes, the first Dialogue Manager in your play session will survive and supplant (at runtime only) any Dialogue Managers that are in other scenes.

The easiest way to manage content is to use a single database. Assign that database to the Dialogue Managers in every scene that has a Dialogue Manager.

I recommend these steps:

1. Consolidate your content into one database. Delete the other, now-unused databases. (You can make a backup of them first if you want to play it safe.)

2. In every scene that has a Dialogue Manager, assign the same one, single database to the Dialogue Manager.

3. You can leave your "dialogue spawn" GameObjects untouched in each scene. Presumably they have Dialogue System Trigger(s), etc. They should be fine as-is.


Although I recommend one database for simplicity, the Dialogue System does support multiple databases. Before you go with multiple databases, read the Working With Multiple Databases link to understand how to work with them properly.
neohazardous
Posts: 7
Joined: Mon Sep 28, 2020 11:38 am

Re: Dialogue System not running between scene changes

Post by neohazardous »

Sorry for the delayed response, but I figured out how to resolve the situation given this information. Thank you so much for your time!
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System not running between scene changes

Post by Tony Li »

Glad to help!
Post Reply