IEnumerator ShowTextBox() { gameLoop = false; routine = true; ui.mainUI.SetActive(false); ui.conversationUI.SetActive(true); ui.endLine = end; ui.currentLine = line; ui.Scrolling(line); while (true) { yield return(null); if (ui.textEnd) { yield return(new WaitForSeconds(1f)); //line = 2; end = 6; ui.AnimationEnd(); ui.conversationUI.SetActive(false); //ui.mainUI.SetActive(true); break; } } routine = false; }