Why my animator is freezzed after WaitForSeconds(Delay)

I have a character with Movement and Attack script. I set animations with bool parameters.

After i Get damage animator is set TakeDamage animation buy won’t play until WaitForSeconds(Delay), Why?

This is my code
191338-unity-ttuwc2yetc.png
public void TakeDamage(int damage)
{
healthScript.GetDamage(damage);

    StartCoroutine(SetTakeDamage());
    
    //getDamageSound.Play();
    ifGotDamage = true;

    if (healthScript.health == 0)
    {
        Die();
    }

}

IEnumerator SetTakeDamage()
{
    anim.SetBool(AnimationTags.TAKE_DAMAGE_PARAMETER, true);

    yield return new WaitForSeconds(takeDamageFrequency);

    anim.SetBool(AnimationTags.TAKE_DAMAGE_PARAMETER, false);
}

Hi @remanam,

more or less: " yield return new WaitForSeconds(takeDamageFrequency);" will stop Animator for takeDamageFrequency seconds… so you can try code below, maybe it will help.

IEnumerator SetTakeDamage()
{
    float _remainingTimeToAnimDamage = takeDamageFrequency;
    while (_remainingTimeToAnimDamage > 0)
    {
        anim.SetBool(AnimationTags.TAKE_DAMAGE_PARAMETER,
        true);
        _remainingTimeToAnimDamage -= Time.deltaTime;
        yield return null;
    }
    anim.SetBool(AnimationTags.TAKE_DAMAGE_PARAMETER,
    false);
    yield return null;
}