IEnumerator Typewriter(string text) { Revealtext.text = ""; textbg.gameObject.SetActive(false); foreach (char c in text) { textbg.gameObject.SetActive(true); Revealtext.text = Revealtext.text + c; yield return(new WaitForSeconds(.03f)); } Debug.Log("wait for input" + WaitForInput); if (WaitForInput) { yield return(null); } else { if (Callback != null) { Callback(); Callback = null; } } yield return(null); }
public void DisplayTextPopup(string text, TextCB CB = null, bool bcontinue = false) { StopCoroutine("Typewriter"); StartCoroutine("Typewriter", (text)); Callback = CB; WaitForInput = bcontinue; Debug.Log("wait for input" + WaitForInput); }