Capturing failed conversation request?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
LilGames
Posts: 29
Joined: Fri Jul 07, 2023 6:38 pm

Capturing failed conversation request?

Post by LilGames »

Do you have a recommended or built-in way to capture a failed attempt to start a conversation? (Let's say the conversation doesn't exist in the database)

eg:
DialogueManager.StartConversation("no_such_conversation");

Right now it's an exception. Should I wrap the call in try-catch?
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: Capturing failed conversation request?

Post by Tony Li »

Hi,

It's not an actual exception; it's just a Debug.LogWarning() message.

You could check if a conversation is active:

Code: Select all

DialogueManager.StartConversation("no_such_conversation");
if (!DialogueManager.isConversationActive) Debug.Log("Failed to start conversation");
Or you could check if the conversation exists first:

Code: Select all

if (DialogueManager.masterDatabase.GetConversation("no_such_conversation"))
{
    DialogueManager.StartConversation("no_such_conversation");
}
LilGames
Posts: 29
Joined: Fri Jul 07, 2023 6:38 pm

Re: Capturing failed conversation request?

Post by LilGames »

You always have a solution! Awesome!
Post Reply