[Solved] How to get current text of dialogue?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ichisan
Posts: 10
Joined: Thu Dec 07, 2017 12:38 am
Location: Indonesia

[Solved] How to get current text of dialogue?

Post 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.
Last edited by ichisan on Wed Jan 30, 2019 10:11 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to get current text of dialogue?

Post 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.
Post Reply