Calling a Coroutine per second

I wanted my timer coroutine to be called per second, I already searched the web for solutions but I already know most of it and it still does not work. Here is my code.

 IEnumerator TimerSeconds()
    {
        while (gameManager.gameState == GameManager.GameState.Level_1 && gameManager.startTimer)
        {
            yield return new WaitForSeconds(1);
            if(timerSec > 0)
            {
                clock.fillAmount -= 0.0142857142857143f;
                timerSec -= 1;
            } else
            {
                clock.fillAmount = 0f;
                timerSec = 0;
            }
            secText.text = timerSec.ToString();
        }
    }

is there something wrong? I’m literally losing my mind here.

What does “it still does not work” mean?

Are you calling this coroutine anywhere? How?

2 Likes

solved it, at first I was calling it in the Update function but that was me having a brain fart. Anyways, I called the coroutine in an onclick function that I have.