Page 1 of 1

OnConversationEnd is never called with OnUse()

Posted: Mon Nov 06, 2017 9:30 pm
by mgregoirelds
Hello,

I currently have a setup where I have a custom GameObject which is having four components:
1) A custom interaction script that is executed upon a OnTriggerEnter2D
2) A BoxCollider2D (necessary for my custom script)
3) A Conversation Trigger script
4) A Override Dialogue UI script

Within the Conversation Trigger script inspector, I do set the conversation I want to start upon calling OnUse().

Now, when OnTriggerEnter2D is called in-game on my custom script, I do start a coroutine that is calling the Conversation Trigger > OnUse() method. My dialogue is displayed properly with my overriden UI and all is great. However, my OnConversationEnd() method implementation within my custom script is never called. Is it normal?

I tried calling DialogueManager.StartConversation() instead. When I am calling this instead of OnUse() on the Conversation Trigger, I do get my OnConversationEnd() method called within my custom script, but it does bypass the Override Dialogue UI script since it uses the defaut Dialogue Manager instead. Any way I can force OnUse() to call my OnConversationEnd()?

Re: OnConversationEnd is never called with OnUse()

Posted: Mon Nov 06, 2017 9:54 pm
by Tony Li
Hello,

Can you assign your custom GameObject to the Conversation Trigger's Conversant field?

Or, if you call DialogueManager.StartConversation() manually, pass the GameObject as the conversant parameter. For example:

Code: Select all

DialogueManager.StartConversation("title", player.transform, customGameObject.transform);
To help identify the problem, you can temporarily set the Dialogue Manager's Debug Level to Info. Then play the scene and start the conversation. Examine the Console window for a line similar to:

Code: Select all

Dialogue System: Starting conversation 'title' with actor=XXX and conversant=YYY.
Make sure YYY is your custom GameObject. The Override Dialogue UI will only be used if the custom GameObject is YYY (or XXX).

Similarly, OnConversationEnd(transform) will only be called on the Dialogue Manager GameObject and XXX and YYY.

Re: OnConversationEnd is never called with OnUse()

Posted: Mon Nov 06, 2017 10:17 pm
by mgregoirelds
Hi,

Thanks for the super quick answer!

Turns out, I had my Conversant and Actor set to my custom GameObject. In that specific case, OnConversationEnd() was never called. I removed the Actor field value and it worked. This is great!

Still, I don't know why but the logs between the OnUse() call and the

Code: Select all

DialogueManager.StartConversation("title", player.transform, customGameObject.transform);
is different. I don't get my Override Dialogue UI shown (default is used) when calling directly DialogueManager.StartConversation.

Anyway, I prefer using the OnUse() method, but I really don't know why it's not working. I will investigate further tomorrow.

Thanks again!

Re: OnConversationEnd is never called with OnUse()

Posted: Mon Nov 06, 2017 10:38 pm
by Tony Li
Please feel free to post the log lines for each method. Or you can send a reproduction project / scene to tony (at) pixelcrushers.com. I'll be happy to take a look.