- Home /
Question by
Lewey100 · Mar 02, 2018 at 12:47 AM ·
c#coroutinewaitforsecondsienumerator
Can't get past WaitForSeconds in my coroutine
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.
Comment
Best Answer
Answer by Lewey100 · Mar 02, 2018 at 12:57 AM
I was setting timeScale to 0 elsewhere in my code. Woops. I need coffee.
Your answer
Follow this Question
Related Questions
WaitForSeconds Not Working 4 Answers
How to stop coroutines, when paused 2 Answers
wait a second before say path is valid? 2 Answers
How Return Or Restart A Coroutine When A Variable Increase? 0 Answers
Delay after input? 1 Answer