Timer Stopping Randomly

I have a stop watch, it’s a pretty simple code, here’s the script,

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class StopWatch : MonoBehaviour
{
    private float timer;
    public float defaultTime = 20;
    bool countingDown;
    public TextMeshProUGUI timeText,startStopText;
    public AudioSource click, timerCountingSnd, timerEndSnd;

    void Start()
    {
        timer = defaultTime;
    }

    void FixedUpdate()
    {
        if (countingDown && timer > 0)
        {
            timer -= Time.deltaTime;
        }
        if(timer < 0)
        {
            timer = 0;
            if (countingDown)
            {
                timerEndSnd.Play();
                StartTimer();
            }
        }

        timeText.text = Mathf.CeilToInt(timer).ToString();
    }

    public void StartTimer()
    {
        if (countingDown)
        {
            StopTimer();
        }
        else if (timer > 0)
        {
            timerCountingSnd.Play();
            countingDown = true;
            startStopText.text = "Stop";
        }
    }
    public void StopTimer()
    {
        timerCountingSnd.Stop();
        countingDown = false;
        startStopText.text = "Start";
    }

    public void IncreaseTime()
    {
        click.Play();
        if (timer > 990)
            {
                timer = 990;
            }
            timer += 10;
            timeText.text = Mathf.CeilToInt(timer).ToString();
       
    }

    public void DecreaseTime()
    {
        click.Play();
        timer -= 10;
        timeText.text = Mathf.CeilToInt(timer).ToString();
    }

    public void RestartTimer()
    {
        if (!countingDown)
        {
            click.Play();
            timer = defaultTime;
        }
    }
}

The 4 methods on the bottom are used in buttons. I have a strange issue though, I have never encountered it personally in my own testing, but when I send it to my friend, he said the timer occasionally stops randomly. He set it for 3 minutes and it stopped at 46, the buttons text still said stop so logically the timer should’ve been running, but it wasn’t.

I can’t for the life of me figure it out, I’ve tested it a million times, the timer never stops at anything either than 0. In both cases it’s a Windows 10, so it shouldn’t be a platform issue or anything.

Does anyone have any idea what’s going on here?

Thanks

Any possible way this component could have been disabled? (Or its game object made inactive, directly or indirectly.)

Any possible way the game might have lost focus? If so, did you check the “run in background” checkbox in the player settings?

Anything in the game that modifies Time.timeScale or Time.fixedDeltaTime?

If you can’t figure out what’s wrong, try to watch your friend using the timer (or get your friend to make a video of them using the timer). Sometimes the tester and the programmer don’t realize they’re making different assumptions about how to use or test the program. (Sometimes the user will even lie about what they did. Usually not intentionally–sometimes your brain just blips over some detail that doesn’t seem important–but it still causes huge problems for reproduction.)

Incidentally, it’s pretty misleading that you call a function called StartTimer in order to make the timer stop.

And there’s some minor performance issues in there (which probably don’t matter if this program is only used as a timer).

This is pretty much the only script in the scene. It could’ve just lost focus, I checked the “run in background” checkbox just now. Well, the only other thing that modifies timescale is the menu button, but it only sets it to 0 when paused, and then reverts back to 1, and I don’t think he pressed the menu button.

Haha, yeah, it’s actually because I used to only have a StartTimer method, I created the StopTimer method after the fact. And yeah, I do need to do some clean up on the code. I have some ideas, I actually just made it only play the sound if the sound is not playing now, but I’m open for suggestions, I love learning new optimization skills.

Also I just realized this is on a FixedUpdate method, I have no idea why I did that XD