- Home /
This question was
closed Apr 30, 2020 at 10:18 AM by
Bunny83 for the following reason:
Problem is outdated. UnityScript is no longer supported. For C# use WaitUntil / WaitWhile instead
Question by
superventure · May 28, 2011 at 03:32 AM ·
booleanyieldwait
yield function until a boolean is true?
How does one tell a function to wait until a boolean becomes true?
quick example of situation
function attackOne(){
run = true; walk = false; LookAtFoe = true;
// some how tell this function to wait and continue until bool is true?
if(inDistanceFoe){
animation.Crossfade("Punch");
FoeHealth -=20;
}
run = false;
StartCoroutine("backUp");
StopCoroutine("attackOne");
}
Thank you
Comment
Best Answer
Answer by Antony-Blackett · May 28, 2011 at 04:01 AM
while( !myBoolTrue )
{
yield return null;
}
Follow this Question
Related Questions
Waiting for input using yield and coroutines 1 Answer
Yield Waitforseconds not working at all 3 Answers
Problem with yield waitForSeconds in for loop 0 Answers
How can I use a yeild during an udate? 1 Answer
Yield to wait for delegate call 1 Answer