How do i delay function Update

Hi i’m working on a tron game for class and i’m running into a problem. I have a count down that plays then the vehicle moves and all that works fine but while the vehicle is sitting the player is still able to turn the vehicle left and right while its sitting there. To yield it from moveing i had var speed:int = 0 then i did speed = 0 then yield WaitForSeconds (5); then speed = 130 but that just makes it stop. i dont want to be able to turn either here is my turning script… i was wondering how to delay that script as well. I thought maybe if i could delay the function update for five seconds that would work but i dont know if thats possible.

#pragma strict function Update () { //makeing the bike rotate 90 degrees at a time if(Input.GetButtonDown("RIGHT")) { transform.Rotate(Vector3(0, 90, 0)); } if(Input.GetButtonDown("LEFT")) { transform.Rotate(Vector3(0, -90, 0)); } }

You could put a boolean value in the file, and check it:

At the top of the file:

var raceStarted = false;  // Set this to true when the race starts

Then change the two lines in Update().

if(raceStarted && Input.GetButtonDown("RIGHT")) { transform.Rotate(Vector3(0, 90, 0)); } 
if(raceStartee && Input.GetButtonDown("LEFT")) { transform.Rotate(Vector3(0, -90, 0)); } }


Try this:

yield waitThenStart(3.0); //"waitThenStart" function gets called

function Awake() {
	enabled = false;

function waitThenStart(startIn : float) {
    yield WaitForSeconds(startIn); //wait until the seconds passed we hand over in the parameter
    enabled = true; //activate the "Update function"

function Update() {
	... //normal code we want to exucuted every frame