Hi Tony,
I’m using a conversation as a template for a type of encounter where the content of the conversation is changed by script.
I used this piece of code:
Conversation conversation = database.GetConversation(conversationName);
DialogueEntry dialogueEntry = conversation.GetDialogueEntry(“nameID");
dialogueEntry.currentDialogueText = “Text Value";
While it works before the conversation is called, the values aren’t changed while the conversation is active. How would I go about changing the value of dialogue entries that’s already loaded?
Change Dialogues at Runtime
Re: Change Dialogues at Runtime
Hi,
You can use an OnConversationLine() method. For example, if you add this method to a script on the Dialogue Manager GameObject, it will replace "{TIME}" with the current system time:
You can use an OnConversationLine() method. For example, if you add this method to a script on the Dialogue Manager GameObject, it will replace "{TIME}" with the current system time:
Code: Select all
void OnConversationLine(Subtitle subtitle)
{
// A Subtitle is a line of dialogue that's about to be shown in the UI, and its corresponding sequence.
// Here, we replace {TIME} with the system time:
subtitle.formattedText.text = subtitle.formattedText.text.Replace("{TIME}", System.DateTime.Now.ToString());
}
Re: Change Dialogues at Runtime
Thanks for pointing me to the right documentation. This will help!
Re: Change Dialogues at Runtime
Glad to help! If you have questions about using that method, just let me know.