So I have a coroutine which should wait 7 seconds, then set a text field to “”. However, Debug.Log i placed after the WaitForSeconds call never fires.
void DisplayUsername(IResult result)
{
Text UserName = DialogUsername.GetComponent<Text>();
if(string.IsNullOrEmpty(result.Error))
{
UserName.text = "Hi, " + result.ResultDictionary["first_name"];
StartCoroutine(RemoveWelcomeMessage(UserName));
}
else
{
Debug.Log(result.Error);
}
}
IEnumerator RemoveWelcomeMessage(Text message)
{
yield return new WaitForSeconds(1);
message.text = "";
}
I used the exact same method to Destroy objects in other scripts but I can’t figure out why this never gets through the Wait. Any ideas?
Greatly appreciated.