OnConversationEnd is never called with OnUse()

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
mgregoirelds
Posts: 106
Joined: Wed Aug 23, 2017 4:10 pm
Location: Canada

OnConversationEnd is never called with OnUse()

Post 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()?
Unity 2022.3.17f1
Dialogue System 2.2.44.1
OpenAI Addon 1.0.12
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationEnd is never called with OnUse()

Post 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.
mgregoirelds
Posts: 106
Joined: Wed Aug 23, 2017 4:10 pm
Location: Canada

Re: OnConversationEnd is never called with OnUse()

Post 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!
Unity 2022.3.17f1
Dialogue System 2.2.44.1
OpenAI Addon 1.0.12
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationEnd is never called with OnUse()

Post 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.
Post Reply