Hello
I have some problem with a simple script
I couldnt use yield WaitForSeconds(); in an awake function,
so I made a seperate function, I suspect it´s something wrong about how I have built this up.
var ljus : Light;
var blinka : boolean = true;
var frekvens : float;
function Awake(){
Blinka();
}
function Blinka () {
while (blinka){
ljus.enabled = false;
yield WaitForSeconds(frekvens);
ljus.enabled = true;
}
}
You didn’t say what the problem actually was but I’m guessing, as Acid did, that the light stays off all the time. The reason is, you enable it then immediately disable it again before waiting. Add a second yield WaitForSeconds after enabled = true, so the light will spend some time switched on before switching off again.
ok I solved it I added a second yield, and I guess it had disabled the blinka in the inspector, cant remember doing that though but it works now so thank you so much.