2016年12月13日 星期二

Unity_StartCoroutine使用



StartCoroutine的使用
簡單說就像是額外開一個Thread(但其實還是在主Thread裡面),不會影響到主線程的進度

傳回值設成IEnumerator就可以被使用




延遲三秒(實用)(放在回傳值函數是IEnumerator的方法中):
yield return new WaitForSeconds(3);


等待畫面的禎數都跑完後再執行
yield return new WaitForEndOfFrame ();


停止xxxCoroutine

StopCoroutine("DoSomething");
   
停止全部Coroutine
StopAllCoroutines();

沒有留言:

張貼留言