Is there an alternative to Time.deltaTime?

I’m making a timer for my game and I’m trying to make it similar to actual seconds and minutes. I was using Time.deltaTime but whenever I put a large number like 100 it decrease very fast and stops it around normal seconds when it reaches around 5 or 6. My code is

public TextMeshProUGUI displayMinutes;
public TextMeshProUGUI displaySec;
private string input;
public float result;
public float subTime = 1f;

public void ReadScriptInput(string Time)
{
 
    input = Time;
    Debug.Log(input);
    result = float.Parse(input);
    

}
void Start() 
{
    

}
void Update()
{
    SubtractTime();
    DisplayTimer(result);
}

public void SubtractTime() 
{ 
    for (float i = 0; i < result; i++)  {

        result = result - Time.deltaTime;
        Debug.Log(result);
    }  

}

public void DisplayTimer(float currentTime)
{
    currentTime += 1;

    float minutes = Mathf.FloorToInt(currentTime / 60);
    float seconds = Mathf.FloorToInt(currentTime     % 60);
    displayMinutes.text = Mathf.Round(minutes).ToString();
    displaySec.text = Mathf.Round(seconds).ToString();

}

is there any solution to this issue?

I find your “SubtractTime()” function… confusing.

If your goal is to count down time in real time, why are you using a loop to count a bunch of times simultaneously?

For example, say you set “result” to 100 (seconds) to start:

for(float i = 0; i < result; i++)
{
	result -= Time.deltaTime;
}

Let’s say your framerate’s terrible. 2 frames per second. You would run through 66 passes of this script, until i = 65 and “result” reaches 66 (reduced by 0.5 per pass through the loop at 2 frames per second). And that’s just the first frame!

More realistically, you might be running at something like 60 frames per second, so your loop would reduce the value of “result” by ~0.01666 per cycle of the loop while still increasing i by 1 per cycle, converging between 98 and 99. Again, that’s just the first, single frame.

Furthermore, your “DisplayTimer()” function adds 1 to the provided “result” value no matter what, then treats it as seconds. Rounding the value afterward would be weird if you weren’t already Flooring the values, converting them to integers (FloorToInt()), then converting them right back to float values anyway.

Since Time.deltaTime is, simply, the elapsed time of the frame, it’s much more sensible in general to use it as-is for a straightforward timer.

void Update()
{
	result -= Time.deltaTime;
	DisplayTimer(result);
}

// Changed variable name for clarification
void DisplayTimer(float remainingTime)
{
	int minutes = Mathf.FloorToInt(remainingTime / 60f);
	int seconds = Mathf.FloorToInt(Mathf.Repeat(remainingTime, 60f));
	displayMinutes.text = minutes.ToString();
	displaySec.text = seconds.ToString();
}