From 70ee31ea614d248f67f3d98ada5acb981def7e58 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 6 May 2021 09:43:22 +0800 Subject: *misc --- Assets/Test/08_Button/UI08Button.cs | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Assets/Test/08_Button/UI08Button.cs (limited to 'Assets/Test/08_Button/UI08Button.cs') diff --git a/Assets/Test/08_Button/UI08Button.cs b/Assets/Test/08_Button/UI08Button.cs new file mode 100644 index 0000000..ec9f992 --- /dev/null +++ b/Assets/Test/08_Button/UI08Button.cs @@ -0,0 +1,39 @@ +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); + } + } + +} -- cgit v1.1-26-g67d0