I’m doing a dialogue manager, and it works except for a polish thing, which is that the text starts playing without waiting for the text box to appear (it takes around 0.25 seconds for the text box to appear, which is not much, but for a slight moment, the text can be seen written in the air because they start at the same time). I tried putting the text box appearance and the dialogue starting as different methods, and then calling an Invoke to make the dialogue wait a little (around 0.4 seconds, just to be sure the text Box is there). The problem is that I can’t Invoke the method beacuse it has a parameter with the data for my dialogue
//This is my DialogueManager Script
public void TextBoxAppear()
{
boxAnimation.SetBool("isOpen", true);
}
public void StartDialogue (Dialogue dialogue)
{
//Code to show the dialogue
}
I’m invoking it from a trigger script, like this
public void Dialogue()
{
dialogueStart = true;
FindObjectOfType<DialogueManager>().TextBoxAppear();
FindObjectOfType<DialogueManager>().StartDialogue(dialogue);
}
I tried changing the Start Dialogue into an Invoke, like this:
public void Dialogue()
{
dialogueStart = true;
FindObjectOfType<DialogueManager>().TextBoxAppear();
FindObjectOfType<DialogueManager>().Invoke ("StartDialogue(dialogue)", 0.4f);
}
But it doesn’t work. Is there some place to place the parameter outside of the string or is there some way around it? I saw a post that recommended using Coroutines and using a WaitForSeconds, but I don’t know if that could work since I’m calling the Coroutine from another Script.
I would appreciate any help