Version: 2020.1

WaitForSecondsRealtimeConstructor

切换到手册
public WaitForSecondsRealtime (float time);

描述

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

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