Help! Reset Time.time?

I have a timer in my game. I used this script to make my timer mounted on GUItext.

function Update()
{   
var theTime : String ;

		
var guiTime = Time.time - startTime;
   
   var minutes : int = guiTime / 60;
   var seconds : int = guiTime % 60;
   var fraction : int = (guiTime * 10) % 10;
   
   guiText.text = String.Format ("{0:00}:{1:00}:{2:00}", minutes, seconds, fraction);
}

but when i restart this current level the timer still the same even if i change the guiTime = 0.

any suggestion? thanks!

If I understand you, you want to be able to reset this timer back to 0 for when you start new levels?

Off the top of my head, you could have another variable be used as an offset and it’s set to Time.time when you want to reset it:

private var m_TimerResetOffset = 0;

function Update()
{   
	var theTime : String ;

      
	var guiTime = Time.time - startTime - m_TimerResetOffset;
   
	var minutes : int = guiTime / 60;
	var seconds : int = guiTime % 60;
	var fraction : int = (guiTime * 10) % 10;
   
	guiText.text = String.Format ("{0:00}:{1:00}:{2:00}", minutes, seconds, fraction);
}


function ResetTimer()
{
	m_TimerResetOffset = Time.time;
}

You would call “ResetTimer()” when you want the timer to reset to 0. By setting it to the current Time.time, I think it should essentially cancel it out.