- Home /
Question by
bekiryayla · Apr 04, 2020 at 09:29 AM ·
coroutinecoroutinescoroutine errors
StopAllCoroutines not working
It worked towards stopallcoroutine in the projects I have done before but I can not stop the coroutine I started in this project, please help?
if(collision.gameObject.tag == "Obstacle")
{
gameController.SetActive(false);
gameControllerCs.enabled = false;
gameControllerCs.StopAllCoroutines();
gameObject.SetActive(false);
uıManagementCs.secondCamera.SetActive(true);
uıManagementCs.gameOverPanel.SetActive(true);
gameObject.transform.position = new Vector3(-0.096f, 0.26f, 1.73f);
}
Comment
stop allcoroutines only stop all routines in that mono behaviour so if there are some coroutines out of the scripts you call stopallcoroutines on they wont stop.
you can stop each one this way:
Coroutine routine= null;
lastRoutine = StartCoroutine("YourCoroutine");
// [ ... ]
StopCoroutine("YourCoroutine");