- Home /
Have a function wait unitl a boolean is false
Hi, I am trying to the delay a function from firing until a specific boolean is false. I found a similar post with an answer of this nature.
 while(myBool)
 {
     yield return null;
 }
However, when i use this i get a syntax error saying it expects a semi colon. Is this C# syntax? If so, what would be the Unity-javascript equivalent? Thanks!
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by syclamoth · Mar 20, 2012 at 09:49 PM
So long as that code is in a coroutine, you're set to go if you use just
 yield;
However, if that isn't in a coroutine, it won't work at all. You will freeze the game.
Your answer
 
 
             Follow this Question
Related Questions
Re-using the "same" for loop? 1 Answer
Ienumerator return string 0 Answers
while loop not looping 2 Answers
Yielding in between functions... 2 Answers
How to return a variable outside NotificationCenter 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                