Unity3D Timer.

Hi,I have tried all sort of ways to make timer.NOTHNG.I need timer which from a particular time goes to zero,when it goes to the end-0,game ends (shows text: time over…) And then i can restart game: pressing restart.And when i finish round (‘‘first’’ level): TIMER STOPS.Help please.

You can attach this script to a GUIText, which can be used to show the remaining time and the message Time Over - create a GUIText, position it and add the script below:

var timer: float = 300; // set duration time in seconds in the Inspector

function Update(){
  timer -= Time.deltaTime;
  if (timer > 0){
    guiText.text = timer.ToString("F0");
  } else {
    guiText.text = "TIME OVER
Press X to restart";
    if (Input.GetKeyDown("x")){ // reload the same level
      Application.LoadLevel(Application.loadedLevel);
    }
  }
}