I’m making a tower defense game. Specifically, a fire tower that deals damage to enemies over time. Here, my fire tower is supposed to deal damage to this enemy at a rate of 6/sec per bullet for 1 sec, but instead it deals at a rate of 6/sec per bullet until the enemies die. My enemy here has 200 health, so no way that it would die before 1 sec. My fire tower shoots 6 bullets per second, and the enemies keep taking damage forever. Every time a bullet hits this enemy, this coroutine is called and the tower the bullet came from is added to the towersBurning list of this enemy. Help!? Why is the tower not getting removed after dur seconds (in this case dur is 1)? THIS IS NOT A DUPLICATE, BECAUSE OTHER SOLUTIONS DO NOT WORK FOR ME

    public IEnumerator HandleFire(Tower tower, float dur)
    {
        towersBurning.Add(tower);
        Debug.Log("add :)"); // this is executed

        yield return new WaitForSeconds(dur);
        towersBurning.Remove(tower); // this does not get executed
        Debug.Log("remove :)"); // this does not get executed
    }

Whoops I just noticed, you aren’t allowed to destroy the object that called the coroutine. In my case, my bullet called the coroutine (which is in side the enemy script) and got destroyed afterward.