Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

Question Coroutine with yield WaitUntil

Discussion in 'Scripting' started by pKallv, Jul 23, 2022.

  1. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,048
    What would be the best way of get this to time out if the WaitUntil condition is not met?
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    1,548
    Using a while loop checking if the bool is false. Have a yield return null (or other) in it and have a timer in it to return the routine once a set time has passed
     
    pKallv likes this.
  3. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,048
    Tx that is how I did it finally.
     
    DevDunk likes this.
unityunity