Page 1 of 2

Dismiss current conversation

Posted: Thu Jun 08, 2017 3:48 pm
by zenasprime
Currently, when I have conversation triggered by OnEnable, the dialogue started remains with the UI even if a new conversation is triggered. How do I explicitly dismiss a conversation either in code or via a Unity Event?

Re: Dismiss current conversation

Posted: Thu Jun 08, 2017 4:18 pm
by Tony Li
Hi,

I assume you've ticked the option to allow simultaneous conversations, right? Otherwise it shouldn't allow the new conversation to start while the old one is active.

You can call DialogueManager.StopConversation() to stop the old conversation before starting the new one.

That's the preferred way to do it. If you need to dig into a list of active conversations, you can access DialogueManager.Instance.ActiveConversationRecords, which is a list of ActiveConversationRecord objects. To end a specific conversation, call its ConversationController property's Close method.

Re: Dismiss current conversation

Posted: Thu Jun 08, 2017 5:33 pm
by zenasprime
I had not but I'll look into that.

And this is exactly what I was looking for. I see there are other functions as well that I can call from an event.

Thank you.

Re: Dismiss current conversation

Posted: Thu Jun 08, 2017 5:37 pm
by zenasprime
Is it advisable to bypass the conversation trigger altogether and simply use Unity Events to trigger conversations?

Re: Dismiss current conversation

Posted: Thu Jun 08, 2017 6:19 pm
by Tony Li
It's up to you. Ultimately they both call DialogueManager.StartConversation(). Conversation Triggers have built in Conditions, though, which can be handy.

Re: Dismiss current conversation

Posted: Fri Jun 09, 2017 10:36 am
by zenasprime
As always, Tony, thanks for the quick and sound advice. You've been a big help. :)

Re: Dismiss current conversation

Posted: Fri Jun 09, 2017 11:01 am
by Tony Li
Glad to help!

Putting a related question out there for everyone: Is there any demand for a version of DialogueManager.StopConversation() that takes a specific conversation title? Such as:

Code: Select all

DialogueManager.StopConversation("Politics at Dinner"); 

Re: Dismiss current conversation

Posted: Sat Jun 10, 2017 6:54 pm
by hellwalker
Would that help with stopping one of simultaneous conversations?

Re: Dismiss current conversation

Posted: Sat Jun 10, 2017 7:46 pm
by Tony Li
hellwalker wrote:Would that help with stopping one of simultaneous conversations?
Yes, as long as you can distinguish the conversations by their titles. If you've started two conversations with the same title, I'd probably program it so that both of them are stopped.

Re: Dismiss current conversation

Posted: Mon Jun 12, 2017 9:46 am
by zenasprime
Is the current Stop() the equivalent of a StopAll()?