unity, 延迟执行代码
使用协程实现比较方便,可以带参数。
void Start(){
StartCoroutine(delayLaunchRocket(rocket,2.0f));
}
IEnumerator delayLaunchRocket(Obj rocket,float delayTime){
yield return new WaitForSeconds (delayTime);
rocket.launch();
}
补充:也可以用Invoke,见:http://www.cnblogs.com/wantnon/p/4823746.html