Timer and TextMesh issue....

I have a TextMesh that has the time of the Timer. My starting time is 63. But I want the TextMesh to display 60 if the TIme is greater then 60 for a special reason.

I tried to do this:

if( timeLeft > 60) {

textMesh = GameObject.Find("Timer").GetComponent(TextMesh);

textMesh.text = 60;

}

But it didn't work...

How can I do this?

assuming textMesh is declared as var textMesh : TextMesh; somewhere and not just var textMesh; you just need to change your code to

textMesh.text = "60";

Alternatively, just clamp the value when you're displaying it (without the if timeLeft > 60 conditional):

var timeLeftClamped : int = Mathf.Clamp(timeLeft, 0, 60);
textMesh.text = timeLeftClamped.ToString();