Blinking object

Hi Guys,

I’m trying to make an object blink with a very basic script:

function Update () 
{
InvokeRepeating("Blink", 0, 0.4);
}


function Blink()
{
renderer.enabled = false;
yield WaitForSeconds(0.2);
renderer.enabled = true;
}

For some reason though, this is not working and i don’t understand why. I’m a complete newbie to scripting so i’m sure it’s an obvious error i’ve made, i just can’t see where!

Any help would be most appreciated! :slight_smile:

I would run a Coroutine instead of an InvokeRepeating… then just say while(true), blinkin… wait, blinkout wait