Bug mixing sequencer LoadLevel command and conversation in the loaded scene

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
varial1720
Posts: 6
Joined: Fri Apr 03, 2015 12:41 pm

Bug mixing sequencer LoadLevel command and conversation in the loaded scene

Post by varial1720 »

Hi!



I'll try to describe my problem the best as I can:



let's say I have a preload scene that does stuffs and just launches another scene where the game is going on and where I want to start a conversation.



If I launch the game scene from the preload scene by script, using Application.LoadLevel, no problem.



If I use a Sequence Trigger (OnStart) that calls the LoadLevel command, then when I arrive on the Game scene, it seems that the conversation database is  empty and not finding anything.



I've joined a repro project, simply change the way to launch the Conversation scene (script or sequence) on the SceneLauncher object and you should be able to reproduce it.



Thanks in advance!



Renaud
varial1720
Posts: 6
Joined: Fri Apr 03, 2015 12:41 pm

Bug mixing sequencer LoadLevel command and conversation in the loaded scene

Post by varial1720 »

Seems that the repro project is too big...
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Bug mixing sequencer LoadLevel command and conversation in the loaded scene

Post by Tony Li »

Hi Renaud,



I just sent you an email with FTP site information where you can upload the repro file.



Almost all Dialogue System activity requires the presence of a Dialogue Manager. If a Dialogue Manager doesn't exist, the Dialogue System will create one.



It sounds like this is what's happening. The Sequence Trigger in the preload scene creates an empty Dialogue Manager. By default the Dialogue Manager is set to "Don't Destroy On Load" and "Allow Only One Instance". When the game scene is loaded, this empty Dialogue Manager destroys the game scene's Dialogue Manager.



There are two solutions:







1. Add a Dialogue Manager to the preload scene. Untick "Don't Destroy On Load". This will destroy this Dialogue Manager before loading the game scene.







2. Or set up your "real" Dialogue Manager in the preload scene, and leave "Don't Destroy On Load" ticked. You can also have a test Dialogue Manager in your game scene so you can playtest it without having to go through the preload scene.







Another option is to have a separate Dialogue Manager in each scene, with "Don't Destroy On Load" unticked on each. The big drawback is that each Dialogue Manager maintains its own Lua environment. If a conversation sets a Lua variable in one scene, it won't carry through to the other scenes, since the scenes have different Dialogue Managers and hence different Lua environments.


Post Reply