WaitForSecondsRealtime

class in UnityEngine

/

Inherits from:CustomYieldInstruction

Switch to Manual

Description

使用未缩放时间将协同程序执行暂停指定的秒数。

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); } }

Constructors

WaitForSecondsRealtime创建一个 yield 指令,以使用未缩放时间等待指定的秒数。

Inherited members

Variables

keepWaiting指示协同程序是否应保持暂停。