Dismiss current conversation

Announcements, support questions, and discussion for the Dialogue System.
zenasprime
Posts: 14
Joined: Tue Apr 11, 2017 1:59 pm

Dismiss current conversation

Post 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?
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dismiss current conversation

Post 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.
zenasprime
Posts: 14
Joined: Tue Apr 11, 2017 1:59 pm

Re: Dismiss current conversation

Post 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.
zenasprime
Posts: 14
Joined: Tue Apr 11, 2017 1:59 pm

Re: Dismiss current conversation

Post by zenasprime »

Is it advisable to bypass the conversation trigger altogether and simply use Unity Events to trigger conversations?
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dismiss current conversation

Post 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.
zenasprime
Posts: 14
Joined: Tue Apr 11, 2017 1:59 pm

Re: Dismiss current conversation

Post by zenasprime »

As always, Tony, thanks for the quick and sound advice. You've been a big help. :)
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dismiss current conversation

Post 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"); 
hellwalker
Posts: 112
Joined: Tue Jan 19, 2016 11:37 pm

Re: Dismiss current conversation

Post by hellwalker »

Would that help with stopping one of simultaneous conversations?
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dismiss current conversation

Post 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.
zenasprime
Posts: 14
Joined: Tue Apr 11, 2017 1:59 pm

Re: Dismiss current conversation

Post by zenasprime »

Is the current Stop() the equivalent of a StopAll()?
Post Reply