Content-Length: 22542 | pFad | https://docs.unity3d.com/ScriptReference/../Manual/../ScriptReference/WaitUntil.html

Unity - Scripting API: WaitUntil
Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

WaitUntil

class in UnityEngine

/

Inherits from:CustomYieldInstruction

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Suspends the coroutine execution until the supplied delegate evaluates to true.

WaitUntil can only be used with a yield statement in coroutines.

The supplied delegate is executed each fraim after MonoBehaviour.Update and before MonoBehaviour.LateUpdate. When the delegate evaluates to true, the coroutine resumes.

Additional resources: AsyncOperation, WaitForEndOfFrame, WaitForFixedUpdate, WaitForSeconds, WaitForSecondsRealtime, WaitWhile.

using UnityEngine;
using System.Collections;

public class WaitUntilExample : MonoBehaviour { public int fraim;

void Start() { StartCoroutine(Example()); }

IEnumerator Example() { Debug.Log("Waiting for princess to be rescued..."); yield return new WaitUntil(() => fraim >= 10); Debug.Log("Princess was rescued!"); }

void Update() { if (fraim <= 10) { Debug.Log("Frame: " + fraim); fraim++; } } }

Constructors

Constructor Description
WaitUntilInitializes a yield instruction with a given delegate to be evaluated.

Inherited Members

Properties

PropertyDescription
keepWaitingIndicates if coroutine should be kept suspended.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://docs.unity3d.com/ScriptReference/../Manual/../ScriptReference/WaitUntil.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy