Whats wrongs with my code?

Hi,

cant seem to figure out whats wrong with this code
#pragma strict

function Start () {
     Debug.Log("The game has started");
     var gameStart : boolean = true;
}

function Update () {
     if(gameStart === true) {
         yield WaitForSeconds (2);
         GetComponent.<Renderer>().enabled = false;
         yield WaitForSeconds (2);
         GetComponent.<Renderer>().enabled = true;
     }
}

Tnx Adam

yield waitforseconds doesn’t work from inside Update. Create your own function and call it using startcoroutine. If you want it to loop, put your code inside of a loop.

More info on coroutines:

Alternatively, you will have to keep track of time yourself using a variable inside of update.