Problems when trying to open / change dialogu ui via code
Posted: Tue Aug 06, 2024 3:16 pm
Hi,
I am trying to use questmachine for my game. However i want to trigger the dialogue at certain points in the game via code to continue with the story while the player runs around.
However, i am facing problems trying to open and update the dialogue UI via code.
i am using custom srt files to have the text updated and synced with the voice over.
For that i am sending a message with the srt file as parameter instead of using the dialogue box.
Now i am facing these problems:
1. The text in the dialogueui is not updated using:
2. I am getting a null ref when passing the questjournal gameobject to the speaker:
This is my (simplified) code:
Am i missing something or is there perhaps a smarter way to make the dialogue UI appear when i update the dialogue box in a node?
I am trying to use questmachine for my game. However i want to trigger the dialogue at certain points in the game via code to continue with the story while the player runs around.
However, i am facing problems trying to open and update the dialogue UI via code.
i am using custom srt files to have the text updated and synced with the voice over.
For that i am sending a message with the srt file as parameter instead of using the dialogue box.
Now i am facing these problems:
1. The text in the dialogueui is not updated using:
Code: Select all
_dialogueUI.bodyTemplate.Assign(srtFileContent);
Code: Select all
_currentSpeaker.StartDialogue(QuestManager.instance.gameObject);
Code: Select all
public void OnGreetMessageSend(MessageArgs messageArgs)
{
_currentSpeaker = QuestMachineMessages.FindGameObjectWithID(messageArgs.sender.ToString()).GetComponent<QuestGiver>();
//todo not working for some reason:
//_currentSpeaker.StartDialogue(QuestManager.instance.gameObject);
_dialogueUI.Show();
ProcessSRTFile(messageArgs.parameter);
}
private void ProcessSRTFile(string srtFileContent)
{
_dialogueUI.bodyTemplate.Assign(srtFileContent);
_dialogueUI.Hide();
}