Hi guys good evening .
I have a problem for timer . when i press a play button the countdown is display number 3 only . I used 3d text not GUI text , because my GUI text is not working so that i used 3D text.
This is my code for COuntdown.js
#pragma strict
var guiCountDown : TextMesh;
var countMax : int;
private var countDown : int;
function Start(){
guiCountDown.active = true;
GameStart();
}
function GameStart(){
var car = gameObject.Find("Car");
var drivingScript = car.GetComponent("Car");
drivingScript.active = false;
var timer = GetComponent("Timer");
timer.active = false;
for(countDown = countMax; countDown >= 0; countDown--){
Debug.Log("Count: " + countDown);
if(countDown == 0){
guiCountDown.text = "GO!";
}
else
guiCountDown.text = countDown.ToString();
yield WaitForSeconds(1);
}
guiCountDown.active = false;
drivingScript.active = true;
timer.active = true;
}
and this is my code in TImer.js
#pragma strict
var pastTime : float;
var guiTime : TextMesh;
function Update (){
pastTime += Time.deltaTime;
guiTime.text = pastTime.ToString ();
}
Help me guys.