If statement for yieldwaitforseconds possible?

I have several cut-scenes but want to find a certain time by using yeidlwaitforsecodns to pause the cut-scene and allow small interaction

So I have a cut scene that lasts 2 minutes and at one minute or yield WaitForSeconds (60); I want to pause the time and allow interaction or the user to press a button to continue.

So basically is something like

if ( yield WaitForSeconds == 60)

{

time.Timescale = 0.0;
//do something

}

Try starting a timer instead :

var timer : float;
var timerTicking : boolean;

function Update(){
if(timerTicking){
timer += Time.deltaTime;
}
if(timer == 60){
//Do Something
}
}

Just set “timerTicking” to true when your cut-scene starts. Hope that helps.

I never actually thought of that, thank you very much, will try that

Nonetheless is it possible to put yieldwaitforseconds in an if statement?

I dont think so.

No, yield WaitForSeconds will not work this way. The reason is, that WaitForSeconds doesn’t return a value. So you haven’t anything to compare to in your if-statement.

Have a nice day …
pixelmechanic

You could achieve the same behavior in a coroutine with no conditionals

Debug.Log("Before waiting");
yield return new WaitForSeconds(60);
Debug.Log("I did something after 60 seconds");

Also - WaitForSeconds does return a value because it’s an IEnumerator. It’s just not particularly useful.

Thank you very much guys, really appreciate the help

Understand much more now.