Hi, I have a problem by creating a script that turns an spotlight on and off very fast by clicking the left mouse button. I cant find the error, because there are no ones in the console. Here is my script:
///////////////////////////////////////////////////////////////////////////////////////
var flashlight : GameObject;
var myLight : Light = flashlight.GetComponent(“Light”);
function Start()
{
myLight.enabled = false;
}
function Update ()
{
if (Input.GetKeyDown(KeyCode.Mouse0)){
print(“Klick”);
myLight.enabled = true;
yield WaitForSeconds(1);
myLight.enabled = false;
}
}
/////////////////////////////////////////////////////////////////////////////////////
When I klick the mouse button the message “Klick” doesn’t appear. But when I remove the yield WFS() and myLight.enable = false; the “Klick” appears in the console and the light goes on.
Mfg Zetatron