Can I cancel a conversation without triggering OnConversationEnd

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hrndz_joseph
Posts: 2
Joined: Tue Mar 11, 2025 8:11 am

Can I cancel a conversation without triggering OnConversationEnd

Post by hrndz_joseph »

Hi,

I use the dialogue system for my company project, and I try to cancel the conversation but the main problem is, some dialogue load a new scene with onConversationEnd, so if I want to go back to main menu, in some case it will load a new scene, and create huge problem.
If anyone know something, it will help me, thanks :] !

Code: Select all

 public void ReturnToMainMenu()
        {
            DialogueManager.StopAllConversations();
            // Rest of the code
        }
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Can I cancel a conversation without triggering OnConversationEnd

Post by Tony Li »

Hi,

OnConversationEnd() is always invoked (on these GameObject) when a conversation ends.

You could set a bool when returning to the main menu. In your OnConversationEnd() handler, check this bool. Example:

Code: Select all

public bool isReturningToMainMenu = false; // You could make this a static property

public void ReturnToMainMenu()
{
    isReturningToMainMenu = true;
    DialogueManager.StopAllConversations();
}

void OnConversationEnd(Transform actor)
{
    if (!isReturningToMainMenu) SaveSystem.LoadScene("Some Scene");
}
In your main menu, set isReturningToMainMenu back to false.
hrndz_joseph
Posts: 2
Joined: Tue Mar 11, 2025 8:11 am

Re: Can I cancel a conversation without triggering OnConversationEnd

Post by hrndz_joseph »

Thanks ! It worked :D
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Can I cancel a conversation without triggering OnConversationEnd

Post by Tony Li »

Glad to help!
Post Reply