Page 1 of 1

Distinguish conversation force stop and conversation end

Posted: Fri Aug 25, 2023 6:30 am
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

Re: Distinguish conversation force stop and conversation end

Posted: Fri Aug 25, 2023 8:29 am
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);
    }
}