Display Time At Game Over Scene

Hi,
I have a game in which you are being chased. If you are caught, the Game Over scene will be loaded. I also have a time up feature;

var min : int;
var sec : int;
var fraction : int;
var timecount : float;
var starttime : float;
var timeCounter : GUIText;

function Start ()
{
starttime = Time.time;
}

function Update () {
timecount = Time.time - starttime;
min = (timecount/60f);
sec = (timecount % 60f);
fraction = ((timecount * 10) %10);
timeCounter.text = String.Format("{0:00}:{1:00}:{2:00}",min,sec,fraction);
}

What would be the best way to stop the timer and display it as a GUI Text on the Game Over scene?

Dude,
I stole your code and used it in my game. My deadline is tomorrow, and it helped me.

I used it like this ;

I have a ‘win screen’ scene, and it runs this script to display the time taken to complete the game.

In Start() I set the finishTime variable to Time.time, because that is all I need to display. I also ‘divvy up’ the mins, secs, and fraction in here.

In OnGUI() I use
GUI.Label(Rect(whatever size),String.Format(“{0:00}:{1:00}:{2:00}”,min,sec,fraction));
to display the result wherever I want.

Obviously my application is different to yours, and I don’t need a running clock. I hope that knowing that a GUI.Label will take String.Format as content helps you in return.