OnConversationCancelled

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
churchmf
Posts: 3
Joined: Thu May 30, 2019 1:59 pm

OnConversationCancelled

Post by churchmf »

Hello,

I'm wondering about the correct way to listen for OnConversationCancelled events. As far as I can tell it doesn't broadcast in the same way that OnConversationStart and OnConversationEnd do (ex: "InformParticipants"). Is that intended?

I would expect to be able to receive OnConversationCancelled in the same way as OnConversationEnd from a participant's monobehaviour.

Alternatively is there a way in OnConversationEnd to determine if a conversation was cancelled?

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

Re: OnConversationCancelled

Post by Tony Li »

Hi,

This table explains which GameObjects receive events such as OnConversationCancelled.

Currently OnConversationCancelled is sent to the Dialogue Manager and its children. After evaluating this further, in the next release (2.1.7.) I'll also make sure it's sent to both participants just like OnConversationEnd.

In the meantime, OnConversationCancelled is called before OnConversationEnd. You could add a script like this to the Dialogue Manager:

Code: Select all

public class CancelledMonitor : MonoBehaviour {
    public static bool wasConversationCancelled;   
    void OnConversationStart(Transform actor) { wasConversationCancelled = false; } 
    void OnConversationCancelled(Transform actor) { wasConversationCancelled = true; } 
}
and check it on your participant character like this:

Code: Select all

void OnConversationEnd(Transform actor) {
    void OnConversationEnd(Transform actor) {
        if (CancelledMonitor.wasConversationCancelled) {
            Debug.Log("Conversation " + DialogueManager.lastConversationStarted + " ended by being cancelled!");
        }
    }
}
churchmf
Posts: 3
Joined: Thu May 30, 2019 1:59 pm

Re: OnConversationCancelled

Post by churchmf »

Thanks for the clarification Tony! When do you expect 2.1.7 to be released?
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationCancelled

Post by Tony Li »

The target release date is this upcoming Friday, June 7.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationCancelled

Post by Tony Li »

Version 2.1.7 has been released. It's available on the Pixel Crushers customer download site right now (PM me your Unity Asset Store invoice number if you need access), or you can wait 3-10 business days and download it from the Unity Asset Store.
churchmf
Posts: 3
Joined: Thu May 30, 2019 1:59 pm

Re: OnConversationCancelled

Post by churchmf »

Great turn around time! Thank you so much
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationCancelled

Post by Tony Li »

Glad to help! Thanks for the suggestion.
Post Reply