[SOLVED] Conversation starts/ends immediately on scene start?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
VolcanoBean
Posts: 8
Joined: Tue May 10, 2016 3:21 pm

[SOLVED] Conversation starts/ends immediately on scene start?

Post by VolcanoBean »

Hello. I've added the ConversationLogger script to my Player game object and when I first start my scene my console shows "Starting conversation" and "Ending conversation" messages for the first conversation in my Dialogue Manager right off the bat. This happens regardless of whether I have actually launched a conversation or not. So the scene starts, no conversation has been triggered, but I still see the starting/ending console messages. The problem is that I have certain events I am triggering when a conversation ends and this is triggering them too early. Is there a setting or something in my Dialogue Manager that I am overlooking that can stop this? Any input would be greatly appreciated.

Thanks for your time,
Gene
Last edited by VolcanoBean on Fri Jul 15, 2016 9:57 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation starts/ends immediately on scene start?

Post by Tony Li »

Hi Gene,

Something is starting a conversation when the scene starts. It could be a component such as Conversation Trigger, or it could be something you've coded.

If you click on the "Starting conversation" line in the Console, it should show a stack trace such as:

Code: Select all

Dialogue System: Starting conversation 'New Conversation 1', actor=Fane (UnityEngine.Transform), conversant=Monsters (UnityEngine.Transform).
UnityEngine.Debug:Log(Object, Object)
PixelCrushers.DialogueSystem.DialogueSystemController:StartConversation(String, Transform, Transform, Int32)
PixelCrushers.DialogueSystem.DialogueSystemController:StartConversation(String, Transform, Transform)
PixelCrushers.DialogueSystem.DialogueManager:StartConversation(String, Transform, Transform)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:Fire(Transform)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform, Transform)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform)
PixelCrushers.DialogueSystem.<StartAfterOneFrame>c__Iterator1A:MoveNext()
The next to last line identifies what component started the conversation:

Code: Select all

PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform)
In this example, it's a Dialogue System Trigger component.

Knowing that, you could search for all instances of DialogueSystemTrigger in your scene by entering "t:DialogueSystemTrigger" in the Hierarchy's search bar. One of them will probably be set to OnStart.

If that doesn't help, please feel free to send an example project to tony (at) pixelcrushers.com. I'll be happy to take a look.
VolcanoBean
Posts: 8
Joined: Tue May 10, 2016 3:21 pm

Re: Conversation starts/ends immediately on scene start?

Post by VolcanoBean »

Thanks, Tony!
What I see in the stack trace is similar to what you posted. But I'm actually seeing different output on the start/end that gets logged when the scene starts as opposed to the start/end when a conversation is properly triggered.

Here is what I'm seeing on the initial start. I don't see a specific trigger:

Code: Select all

The Hero: Starting conversation with The Hater
UnityEngine.Debug:Log(Object)
PixelCrushers.DialogueSystem.ConversationLogger:OnConversationStart(Transform) (at Assets/Dialogue System/Scripts/Supplemental/Utility/ConversationLogger.cs:16)
UnityEngine.Component:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.ConversationModel:InformParticipants(String, Boolean)
PixelCrushers.DialogueSystem.ConversationController:.ctor(ConversationModel, ConversationView, Boolean, EndConversationDelegate)
PixelCrushers.DialogueSystem.DialogueSystemController:PreloadResources()
PixelCrushers.DialogueSystem.DialogueSystemController:Start()
As opposed to what I see on a proper conversation load:

Code: Select all

The Hero: Starting conversation with The Hater
UnityEngine.Debug:Log(Object)
PixelCrushers.DialogueSystem.ConversationLogger:OnConversationStart(Transform) (at Assets/Dialogue System/Scripts/Supplemental/Utility/ConversationLogger.cs:16)
UnityEngine.Component:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.ConversationModel:InformParticipants(String, Boolean)
PixelCrushers.DialogueSystem.ConversationController:.ctor(ConversationModel, ConversationView, Boolean, EndConversationDelegate)
PixelCrushers.DialogueSystem.DialogueSystemController:StartConversation(String, Transform, Transform, Int32)
PixelCrushers.DialogueSystem.DialogueSystemController:StartConversation(String, Transform, Transform)
PixelCrushers.DialogueSystem.DialogueManager:StartConversation(String, Transform, Transform)
PixelCrushers.DialogueSystem.ConversationStarter:StartConversation(Transform)
PixelCrushers.DialogueSystem.ConversationStarter:TryStartConversation(Transform, Transform)
PixelCrushers.DialogueSystem.ConversationStarter:TryStartConversation(Transform)
PixelCrushers.DialogueSystem.<StartConversationAfterOneFrame>c__Iterator16:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
I've created an example project and stripped out any non-essential game objects. Same console results. I'm starting to wonder if there is something I did incorrectly when I created my custom Dialogue UI, but I don't know. I'm really at a loss here. I will email the sample project to you. Thank you so much for offering to take a look! I really appreciate it.

Gene
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation starts/ends immediately on scene start?

Post by Tony Li »

Hi Gene,

On the Dialogue Manager, untick Preload Resources.

Sorry, it slipped my mind to mention this earlier. When Preload Resources is ticked, the Dialogue System not only loads the dialogue UI (which could take a little time if it's a prefab containing a lot of images) but it also starts and immediately stops the first conversation in the database as part of an ultra-thorough preload step. In the vast majority of cases, especially if you're using Unity UI and your dialogue UI is already in the scene, Preload Resources doesn't do anything useful, so it's fine to untick it.

If you're loading a dialogue UI from a prefab, and not using an in-scene instance, you can preload it by calling DialogueManager.PreloadDialogueUI(). Preloading just gets all the images in memory so Unity won't stutter the first time the a conversation starts.
VolcanoBean
Posts: 8
Joined: Tue May 10, 2016 3:21 pm

Re: Conversation starts/ends immediately on scene start?

Post by VolcanoBean »

That did the trick. Thanks for taking the time to check this out and for explaining the preload process more. Much appreciated, sir!

Gene
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: [SOLVED] Conversation starts/ends immediately on scene start?

Post by Tony Li »

Glad to help! Sorry, that's was an obscure one. :-)
Post Reply