IFrames problem / OnTrigger after Invulnerability ends.

I have a bool called “isInvincible”, a player object with 2x CircleCollider2Ds and a spike object.
When my player touches the spike, player becomes invincible for few seconds. But if the player is inside a spike and the invincibility ends, he doesnt get damage - only after he moves inside that spike.
How do I make it detect if he stands inside the spike when the invincibility ends?

Part of the code:

public IEnumerator IFrames()
    {
        circleCollider2.enabled = false;
        isInvincible = true;
        yield return new WaitForSeconds(2);
        isInvincible = false;
        circleCollider2.enabled = true;
    }

EDIT: I realized the issue.
Your problem is that you are disabling the collider. The collider won’t check for new collisions unless it or any collide it is touching moves. Again, this is to save performance. When you disable it, it may forget that it was touching the spike and when it gets reenabled, it doesnt check for collisions since it is not moving and nothing is moving into it. Instead, use the invincibility variable and, when a collision is detected, see if you are still on IFrames before proceeding with the rest of the code. Some of the stuff below may still apply tho.

Old Answer:

Are you using OnTriggerEnter2D()?

If so, all you need to do is change it to OnTriggerStay2D();

It works the exact same way except it calls it consistently while in the collider, not when it is entered.

Another thing I would check would be the rigidbody Sleep Mode is set to “Never,” as that would mean the rigidbody is disabled when it stops moving in order to increase performance.

Beyond that we would need all of the code related to this in order to debug, not just the IEnumerator.