Time's Up Game Over.

Hi, I need help with my players death and Time up UI. Basically I am trying to get a death UI with 2 buttons that says Restart or Quit. I wish that when my timer gets to 0 it pauses the game and brings up 2 buttons saying either to restart or quit. Here under is my timer script

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Timer : MonoBehaviour {

public Text timeText;
public float timer = 120.00f;//Countdown Timer



// Use this for initialization
void Start () {



}

// Update is called once per frame
void Update () {

	timer -= Time.deltaTime;

	timeText.text = "" + timer.ToString ("00:00");

	if (timer <= 0) {

	

		Time.timeScale = 0;
		timeText.text = "Game Over";



}

}
}

Hey,

I would recommend to create a UI gameobject, that is disabled until you wish to use it.

    public GameObject retryMenu; // Set in inspector
    
    void Update()
    {
        timer -= Time.deltaTime;
        timeText.text = "" + timer.ToString ("00:00");
        if (playerDeath || timer <= 0)
        {
            if(!retryMenu.activeSelf) retryMenu.SetActive(true); // Activate Retry UI
          
        }
    }

And then create some methods the retry menu can use to either restart the game or quit the game :wink:

Hope it helps!

try

if (timer <= 0) {

print("It works this far");

//..

}

as a test