How do you make a countdown timer?

I have a game where i have a box and balls fall and you move the box and try to get as many balls as you can. i have a timer already but i need it to countdown from, say… 1.5 mins. Here’s the code i have:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Timer : MonoBehaviour
{
    public bool isPlaying;
    public TextMeshProUGUI txt;
    void Awake() 
    {
        txt = GetComponent<TextMeshProUGUI>();
    }
    // Start is called before the first frame update
    void Start()
    {
        isPlaying = true;
    }

    // Update is called once per frame
    void Update()
    {
        if(isPlaying)
        {
            txt.text = Time.time.ToString("#.00");
        }
    }
}

Any suggestion on how to do this
(BTW: I didnt add this at the top, but could anyone also suggest how to, when time is up to display the score you got within the time limit that you got?) Thx!

~ TCMG

If you want a timer, all you need is a timer value that acts as a threshold (in your example, 1.5 minutes, or 90 seconds), and another value that stores the actual elapsed time. From here, update that value in the Update() method. Something like this should work :

using UnityEngine;

public class Timer : MonoBehaviour
{
    public float threshold;
    public float elapsedTime;

    private void Start()
    {
        elapsedTime = 0f;
    }

    private void Update()
    {
        elapsedTime += Time.deltaTime;

        if (elapsedTime > threshold)
        {
            Debug.Log("Time out!");
            // Do what you want
        }
    }
}

One more thing: How can you round the time to 1 integer(like to round it from 2.339649649 to 2 or 13.8258738 to 14)