I’ve been able to make a countdown timer for my game but have been unable to set it up so that when the timer ends/ hits zero, it switches to a game over scene.
Here’s the time script that I’m working with:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Countdown : MonoBehaviour
{
public float timeStart = 60;
public Text textBox;
void Start()
{
textBox.text = timeStart.ToString();
}
void Update()
{
timeStart -= Time.deltaTime;
textBox.text = Mathf.Round(timeStart).ToString();
}
}
Help would be much appreciated