赞
踩
Creates a yield instruction to wait for a given number of seconds using scaled time. |
,yield return new WaitForSeconds 的等待时间和Time.timeScale有关,我才想起来先前将这个值设置为了0,之后将值改为1后代码正常显示。
这个是代码
- public class IEnumerator_Sctipt : MonoBehaviour {
-
- // Use this for initialization
- void Start () {
-
- StartCoroutine(Test(2f));
-
-
- }
-
-
-
- IEnumerator Test(float waittime)
- {
- Debug.Log("开始执行");
-
- yield return new WaitForSeconds(waittime);
-
- Debug.Log("执行结束");
-
- }
-
-
-
- }

更改unity中的Time.timeScale
希望对某些相同问题的同学有些帮助。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。