It seems that SetBool is not working conditionally.

Click to apply a hammer swing animation.

But sometimes the animation doesn’t work and stays idle.

How do I fix it?

    private void Update()
    {
        if (Input.GetMouseButtonDown(0)) Do_BreakIce();

        Helper.FollowMouse(gameObject);
    }

    protected override IEnumerator Connect_Components_Coroutine()
    {
        spriteRenderer = GetComponent<SpriteRenderer>();
        animator = GetComponent<Animator>();

        cubicIceManager = Helper.FindGameObject("CubicIceManager").GetComponent<CubicIceManager>();
        return base.Connect_Components_Coroutine();
    }

    private void Do_BreakIce()
    {
        "Break!!".Log();
        StartCoroutine(Break_Coroutine());
    }

    private IEnumerator Break_Coroutine()
    {
        animator.SetBool("IsBreak", true);
        while (!Helper.Check_AnimationIsFinished(animator, "hammer")) yield return null;
        animator.SetBool("IsBreak", false);
    }

I’m not sure but can you try this? Maybe the coroutine is working more than once because of the update method?

private bool check = true;

private void Update()
{
    if (Input.GetMouseButtonDown(0) && check)
    {
        check = false;
        Do_BreakIce();
    }
    Helper.FollowMouse(gameObject);
}

private IEnumerator Break_Coroutine()
{
    animator.SetBool("IsBreak", true);
    while (!Helper.Check_AnimationIsFinished(animator, "hammer")) yield return null;
    animator.SetBool("IsBreak", false);
    check = true;
}