Page 1 of 1
DialogueManager.lastConversationStarted not returning active conversation name
Posted: Wed Jul 27, 2022 10:07 am
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
Re: DialogueManager.lastConversationStarted not returning active conversation name
Posted: Wed Jul 27, 2022 11:42 am
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);
}
Re: DialogueManager.lastConversationStarted not returning active conversation name
Posted: Wed Jul 27, 2022 12:04 pm
by ershad
Thank you, that works perfectly
Re: DialogueManager.lastConversationStarted not returning active conversation name
Posted: Wed Jul 27, 2022 1:55 pm
by Tony Li
Glad to help!