【发布时间】:2016-04-22 13:19:30
【问题描述】:
我正在尝试使用Coroutines 旋转魔方的平面,这是我的代码:
IEnumerator RotateUpperFacecw(){
while(Mathf.Abs(totalRotation) < 90f){
totalRotation += 10;
Parent.transform.RotateAround(red.transform.position,Vector3.up,10);
yield return 0;
}
if(Mathf.Abs(totalRotation)>=90f){
totalRotation=0;
Update(UpperFace);
}
}
但是当我尝试像这样连续两次调用协程时
StartCoroutine(RotateUpperFacecw());
StartCoroutine(RotateUpperFacecw());
它给出了错误的结果。
我尝试调用第一个,等待一秒钟然后再次调用它,它很好,但我不明白,(yield return 0)不应该阻塞执行直到这个协程结束?
我错过了什么?
【问题讨论】: