DialogueManager.lastConversationStarted not returning active conversation name

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ershad
Posts: 2
Joined: Wed Jul 27, 2022 9:59 am

DialogueManager.lastConversationStarted not returning active conversation name

Post by ershad »

Hello, im trying to get the name of the active conversation

Currently I have 2 conversations Untitled, Untitled 2 and my database is setup like

Untitled
links to
Untitled 2

When debugging DialogueManager.lastConversationStarted it always gives Untitled even if i have gone to next conversation.

Please help
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: DialogueManager.lastConversationStarted not returning active conversation name

Post by Tony Li »

Hi,

When an active conversation follows a cross-conversation link, it's still conceptually thought of as the same conversation, so DialogueManager.lastConversationStarted doesn't change.

To record the name of the conversation that you crossed into, add a script with an OnLinkedConversationStart() method, and check DialogueManager.currentConversationState.subtitle.dialogueEntry.conversationID. You'll typically add this script to the Dialogue Manager GameObject. Here's an example method:

Code: Select all

public void OnLinkedConversationStart(Transform actor)
{
    int conversationID = DialogueManager.currentConversationState.subtitle.dialogueEntry.conversationID;
    Conversation conversation = DialogueManager.masterDatabase.GetConversation(conversationID);
    Debug.Log("Crossed into: " + conversation.Title);
}
ershad
Posts: 2
Joined: Wed Jul 27, 2022 9:59 am

Re: DialogueManager.lastConversationStarted not returning active conversation name

Post by ershad »

Thank you, that works perfectly :)
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: DialogueManager.lastConversationStarted not returning active conversation name

Post by Tony Li »

Glad to help!
Post Reply