Page 1 of 1

[Solved] How to get current text of dialogue?

Posted: Mon Nov 05, 2018 5:16 pm
by ichisan
Hello. Can I use independent script to get the current text of current dialogue? I need that to process text effect for each word.

Update: Thanks Tony, it works as you said. Sorry it takes long time for me to update this thread as solved.

Re: How to get current text of dialogue?

Posted: Mon Nov 05, 2018 6:50 pm
by Tony Li
Hi,

Yes. You can add a script to the Dialogue Manager that has an OnConversationLine method. (See Script Messages.) The Dialogue System will call this method with every subtitle. Example:

Code: Select all

using PixelCrushers.DialogueSystem;
...
void OnConversationLine(Subtitle subtitle) {
    Debug.Log("About to show the text: " + subtitle.formattedText.text);
}
You can also read DialogueManager.currentConversationState whenever a conversation is active -- that is, when DialogueManager.isConversationActive is true. This has all the information about the current conversation state.