IEnumerator DisplayTutorial() { while (!isActivated) { Debug.Log("Start of Iteration"); switch (index) { case 0: Debug.Log("entering case"); for (int i = 0; i < tutorials.Length; i++) { Debug.Log("entering for" + i); if (i == index) { tutorials[index].SetActive(true); Debug.Log("Activated"); } else { tutorials[i].SetActive(false); } } yield return(StartCoroutine(WaitForKeyDown())); break; case 1: for (int i = 0; i < tutorials.Length; i++) { if (i == index) { tutorials[index].SetActive(true); } else { tutorials[i].SetActive(false); } } yield return(StartCoroutine(WaitForKeyDown())); break; case 2: for (int i = 0; i < tutorials.Length; i++) { if (i == index) { tutorials[index].SetActive(true); } else { tutorials[i].SetActive(false); } } yield return(StartCoroutine(WaitForKeyDown())); break; } if (index <= 2) { Debug.Log("End of iteration"); yield return(new WaitForEndOfFrame()); } else { playSystem.TranslucentPanelControl(false); isActivated = true; Debug.Log("play System " + playSystem.GetHeroStopFlag()); Debug.Log("pause Flag " + playSystem.GetMenuPauseFlag()); Debug.Log("Game Progress " + playSystem.GetProgress()); foreach (GameObject x in tutorials) { x.SetActive(false); } //Destroy(gameObject); } } }