Hey guys, I’m trying to setup a lap time counter for a racing game I’m working on.
So far this is what I’ve managed to do.
However, while the seconds keep counting I’m not being able to make the minutes go up with this implementation and reset the seconds to 0 when they reach 60.
Help would be greatly appreciated.
var timer = 0.0;
private var mins = 0;
var lapTime: TextMesh;
function Update () {
timer += Time.deltaTime;
// Displays the current time on F2 format (with decimals)
lapTime.text = mins + ":" + timer.ToString("f2");
if(timer == 60.0){
timer = 0;
mins ++;
}
}