How to keep track of previous subtitle text from code
Posted: Tue Dec 14, 2021 1:58 pm
Hi!
I'm trying to make a UI panel that displays the previous subtitle text of an active conversation, starting from the second conversation entry, since the first one does not have a previous entry.
From my conversation actor I'm using the function OnConversationLine, and calling a function that updates the UI panel. To clarify, I'm getting the subtitle text using: DialogueManager.CurrentConversationState.subtitle.formattedText.text .
The OnConversationLine function gets called before the conversation line is spoken and it works great, but when the entry node is a player response node, it gets called after the conversation line is spoken, which in my case, causes the desired line to be displayed not being displayed.
E.G. :
In short, what's the right way to keep track of the previous subtitle text of an active conversation?
I'm trying to make a UI panel that displays the previous subtitle text of an active conversation, starting from the second conversation entry, since the first one does not have a previous entry.
From my conversation actor I'm using the function OnConversationLine, and calling a function that updates the UI panel. To clarify, I'm getting the subtitle text using: DialogueManager.CurrentConversationState.subtitle.formattedText.text .
The OnConversationLine function gets called before the conversation line is spoken and it works great, but when the entry node is a player response node, it gets called after the conversation line is spoken, which in my case, causes the desired line to be displayed not being displayed.
E.G. :
Code: Select all
public void OnConversationLine(Subtitle subtitle)
{
UpdateLastResponseShown();
}
public void UpdateLastResponseShown()
{
if (IsTheFirstEntry)
{
lastResponse = DialogueManager.CurrentConversationState.subtitle.formattedText.text;
lastResponseDisplay.text = "";
}
else
{
lastResponseText.text = lastResponse;
lastResponse = DialogueManager.CurrentConversationState.subtitle.formattedText.text;
}
}