Hello, I apologize if this topic has already been described in the documentation, but it's hard for me to search in a language that is foreign to me. I'm using the Quest Machine, and I probably haven't figured it out well yet. How do I get the text values (Dialogue, Journal, HUD, etc.) in my script?
Example:
public TextMeshProUGUI textHUD = default;
public TextMeshProUGUI textJournal = default;
public ShowText()
{
textHUD.text = ?
textJournal.text = ?
}
Text in my script
Re: Text in my script
Hi,
I assume you want to get the text for the quest's current state.
First you need a reference to the quest. For example, you can use QuestMachine.GetQuestInstance():
Then use Quest.GetContentList():
Every QuestContent has a runtimeText property. So you can get the complete text like this:
I assume you want to get the text for the quest's current state.
First you need a reference to the quest. For example, you can use QuestMachine.GetQuestInstance():
Code: Select all
Quest quest = QuestMachine.GetQuestInstance("A Quest ID");
Code: Select all
List<QuestContent> contentList = quest.GetContentList(QuestContentCategory.HUD);
Code: Select all
string text = string.Empty;
foreach (QuestContent content in contentList)
{
text += content.runtimeText + "\n";
}
Re: Text in my script
This is what I need, thanks