StartCorountine not woking when I call it from another script

I have a IEnumerator with a while loop that should run 100 times that works perfectly when I call this from the start method in the same script. But when I call the IEnumerator from another script it gets called but the while loop only run once.

public class script1: MonoBehaviour
{
 private void Start()
    {
        //StartCoroutine(StartCountdown(3));
       // When I call it here the while loop runs 100 
    }
 public IEnumerator StartCountdown(float countdownValue)
    {
        float waiteTime = countdownValue / 100;

        int loopNumber = 100;
        //float idk = 0;
        while (loopNumber > 0)
        {
            Debug.Log("aufgerufen");
            circle.fillAmount -= 0.01f;

            yield return new WaitForSeconds(waiteTime);
            loopNumber -= 1;
        }
    }
}



public class script2 : MonoBehaviour
{
public void GameOver()
    {
        
        panel.SetActive(true);
        Time.timeScale = 0;

        GameObject circle = GameObject.FindGameObjectWithTag("LoadCircle");
        StartCoroutine(circle.GetComponent<LoadCircle>().StartCountdown(3));
        
        //When  I call it from here the while loop only run once
    }
}

For someone who have the same problem. Time.timeScale = 0; this affect the WaitForSeconds just change this to WaitForSecondsRealtime and it will work fine!

Coroutines are only running as long as the GameObject and the Component, where it is assigned to, are active.

As soon as either your GameObject is set active to false or the component is disabled (just if it’s only for a short moment) then the Coroutine stops and have to be started again.

Maybe that’s your problem?