Distinguish conversation force stop and conversation end

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
OceaneM
Posts: 9
Joined: Thu Apr 27, 2023 11:08 am

Distinguish conversation force stop and conversation end

Post by OceaneM »

Hello,

Is there a way to check if a conversation has been forced stopped (by calling DialogueManager.StopAllConversations();) or if it has come to an end by its own because it reached the end of the conversation?
I'm listening to DialogueManager.instance.conversationEnded but it is called in both cases.
Any idea?

Thank you
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Distinguish conversation force stop and conversation end

Post by Tony Li »

Hi,

There's no distinction. The only distinction is if you use the Dialogue Manager's Input Settings > Cancel Conversation Input to cancel a conversation, which does invoke OnConversationCancelled.

If you're calling DialogueManager.StopAllConversations() in your own script, you could handle it in the same method that calls DialogueManager.StopAllConversations().

If it's happening in a Dialogue System Trigger because the Replace checkbox is ticked, you could make a subclass of DialogueSystemTrigger that overrides DoConversationAction() to check if another conversation is active:

Code: Select all

public class MyDialogueSystemTrigger : DialogueSystemTrigger
{
    protected override void DoConversationAction(Transform actor)
    {
        if (DialogueManager.isConversationActive && replace) { /* your code here */ }
        base.DoConversationAction(actor);
    }
}
Post Reply