使用未缩放时间将协同程序执行暂停指定的秒数。
See WaitForSeconds if you wish to wait using scaled time.
WaitForSecondsRealtime can only be used with a yield
statement in coroutines.
using UnityEngine; using System.Collections;
public class WaitForSecondsExample : MonoBehaviour { void Start() { StartCoroutine(Example()); }
IEnumerator Example() { print(Time.time); yield return new WaitForSecondsRealtime(5); print(Time.time); } }
waitTime | The given amount of seconds that the yield instruction will wait for. |
WaitForSecondsRealtime | 创建一个 yield 指令,以使用未缩放时间等待指定的秒数。 |
keepWaiting | 指示协同程序是否应保持暂停。 |