using UnityEngine; using System; using System.Collections; public class UI08Button : MonoBehaviour { private void Start() { StartCoroutine(Speak()); } void Update() { } IEnumerator Wait5Sec() { Debug.Log("Wait for 5 sec"); yield return new WaitForSeconds(5); Debug.Log("Wait for 5 sec done"); } IEnumerator Speak() { int i = -1; while (true) { Debug.Log("wait 1 sec" + (++i)); yield return new WaitForSeconds(1); yield return StartCoroutine(Wait5Sec()); Debug.Log("wait 2 sec" + (++i)); yield return new WaitForSeconds(2); Debug.Log("wait 3 sec" + (++i)); yield return new WaitForSeconds(3); } } }