problem with countdown timer when scene is reloaded

i used this script for the timer:

public var startTime = 30.0; 

function Start (){


function Update () { 
   //The time left for player to complete level 

   timeLeft = startTime - Time.time;

   //Don't let the time left go below zero 

   timeLeft = Mathf.Max (0, timeLeft); 

   //Format the time nicely 

   guiText.text = FormatTime (timeLeft);

   if(timeLeft == 0)

//Format time like this 

function FormatTime (time) { 

   var intTime : int = time; 

   var minutes : int = intTime / 60; 

   var seconds : int = intTime % 60; 

   var fraction : int = time * 10; 

   fraction = fraction % 10; 

   //Build string with format 


   timeText = minutes.ToString () + ":"; 

   timeText = timeText + seconds.ToString (); 

   timeText += "." + fraction.ToString (); 

   return timeText; 


the death function is on another script:

function Death(){
	gameOverText.enabled = true;
	yield WaitForSeconds(5);

when i press play all works well but when the level is loaded it starts with timer at 0 then the level is loaded every 5 seconds.
whats wrong here?
thanks in advance for any help

I Dont see a variable for timeLeft?

This happens because you are using Time.time for your timer. Time.time constantly rises, and as such does not make a very good timer for things you want to reset! You should keep your own timer for this, instead of reading off the ‘number of seconds since the game was started’.

There is no way to reset Time.time.

However, there is a quick fix for this- in the Start function, add the line-

startTime += Time.time;

This pushes the ‘end’ time ahead, so that the game will show the correct number of seconds every time you load the level.