using UnityEngine; using System.Collections; public class WaitUntilExample :MonoBehaviour{ public int frame; void Start() { StartCoroutine(Example()); } IEnumerator Example() {Debug.Log("Waiting for princess to be rescued..."); yield return newWaitUntil(() => frame >= 10);Debug.Log("Pri...
在协程中,WaitUntil 只能与yield语句结合使用。 每帧都会执行提供的委托,在脚本MonoBehaviour.Update之后MonoBehaviour.LateUpdate之前执行。当委托最终评估为true时,协程将继续其执行。 using UnityEngine; using System.Collections; public class WaitUntilExample :MonoBehaviour{ public int frame; ...
WaitUntil can only be used with a yield statement in coroutines.Supplied delegate will be executed each frame after script MonoBehaviour.Update and before MonoBehaviour.LateUpdate. When the delegate finally evaluates to true, the coroutine will proceed with its execution.Additional resources: Async...
void Update() { if (frame <= 10) {Debug.Log("Frame: " + frame); frame++; } } } Constructors WaitUntilInitializes a yield instruction with a given delegate to be evaluated. Inherited members Variables keepWaitingIndicates if coroutine should be kept suspended....
UnityEditor OtherWaitUntil Constructor Other Versions public WaitUntil(Func<bool> predicate); Parameters predicate Supplied delegate will be evaluated each frame after MonoBehaviour.Update and before MonoBehaviour.LateUpdate until delegate returns true. Description Initializes a yield instruction with a gi...
using UnityEngine; using System.Collections; public class WaitUntilExample :MonoBehaviour{ public int frame; void Start() { StartCoroutine(Example()); } IEnumerator Example() {Debug.Log("Waiting for princess to be rescued..."); yield return newWaitUntil(() => frame >= 10);Debug.Log("Pri...
using UnityEngine; using System.Collections; public class WaitUntilExample :MonoBehaviour{ public int frame; void Start() { StartCoroutine(Example()); } IEnumerator Example() {Debug.Log("Waiting for princess to be rescued..."); yield return newWaitUntil(() => frame >= 10);Debug.Log("Pri...
using UnityEngine; using System.Collections; public class WaitUntilExample :MonoBehaviour{ public int frame; void Start() { StartCoroutine(Example()); } IEnumerator Example() {Debug.Log("Waiting for princess to be rescued..."); yield return newWaitUntil(() => frame >= 10);Debug.Log("Pri...
class in UnityEngine / 継承:CustomYieldInstruction 説明 指定されたデリゲートがTrueに判定されるまでコルーチンの実行を中断します。 WaitUntil はコルーチンのYieldステートメントでのみ使用できます。 供給されたデリゲートはスクリプトMonoBehaviour.Updateの後とMonoBehaviour.LateUpdateの前に各フレ...
class in UnityEngine / 継承:CustomYieldInstruction 説明 指定されたデリゲートがTrueに判定されるまでコルーチンの実行を中断します。 WaitUntil はコルーチンのYieldステートメントでのみ使用できます。 供給されたデリゲートはスクリプトMonoBehaviour.Updateの後とMonoBehaviour.LateUpdateの前に各フレ...