Tuesday, May 31, 2022
HomeGame DevelopmentUnity Coroutine freezes sport despite the fact that no loop

Unity Coroutine freezes sport despite the fact that no loop


Each time I name this perform that begins the coroutine Faint, it freezes the sport. I don’t perceive why this freezes the sport although, as a result of the coroutine doesn’t have any loop.

public void StartFaint()
{
    faintSecs = 1.5f;
    StartCoroutine("Faint");
}

IEnumerator Faint()
{
    ChangeState(true);
    yield return new WaitForSeconds(1.5f);
    ChangeState(true);
    yield break;
}

ChangeState() simply modifications the worth of some variables.
The Coroutine is simply being began as soon as.

In accordance with the web, yield break is meant to terminate the coroutine…however perhaps I am mistaken?

Thanks upfront.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments