yieldreturnnewWaitForEndOfFrame();//等待当前帧执行完成 print("WaitForEndOfFrame: "+Time.time); yieldreturnnull; print(Time.time); } } 运行效果 注意:如果协程还未运行完,对象的active被设置成false,会导致报错:Coroutine couldn't be started because the the game object 'xxx' is inactive!
This stops all Coroutines started by the script on which it is called so it won’t affect other Coroutines running elsewhere. It does, however, stop Coroutines that were started by the behaviour on which it was called, even if they’re in other scripts on other objects. For example… I...