using UnityEngine; using System.Collections; public class StartTest : MonoBehaviour { bool isover = true; // Update is called once per frame void Update () { if (isover) { isover = false; StartCoroutine ("StartCoroutineTest"); } } IEnumerator StartCoroutineTest() { for (int i=0; i<=10000; i++) {//这里会每帧执行一次循环 Debug.Log("i="+i); if(i==10000) isover = true; yield return null; } } } |
|