WaitForSeconds question

Hi All,

I’m having a bit of trouble with WaitForSeconds. If I pass in a float directly into it, it works fine. However, when I use a variable, it does not work. Am I missing something, or is WaitForSeconds not meant to work this way? Thanks in advance!

//this works
yield WaitForSeconds(0.5); 


//this doesn't work
var delay : float = 0.5f;

yield WaitForSeconds(delay);

It should work, you are doing something wrong but I can’t see anything from code.

It works fine. If your “delay” variable is a public variable, remember that public variables get their values from the inspector, not your code (aside from the initial assignment).

–Eric

I’m an idiot. That was the problem. I should have known beter :slight_smile: Thanks.