How to have a collider inactive only during attack animation and not during 'charging' animation?

When the player holds mouse 1, I want a charging animation to play once, and the attack animation to then loop. I have the animations themselves down, and a collider is activated upon attacking, however the collider is also present while charging, as the charging animation leads into the attack animation.
How do I make it so that the collider is only active during the attack animation.

public class Hand : MonoBehaviour {

    private Animator anim;
    public CapsuleCollider cc;

	// Use this for initialization
	void Start () {
        anim = GetComponent<Animator>();

        cc.enabled = false;
    }
	
	// Update is called once per frame
	void Update () {
        if (Input.GetButton("Fire1"))
        {
            anim.SetBool("IsNoInput", false);
            anim.SetBool("IsCharging", true);
			anim.SetBool("IsAttacking", false);

			
        }
        else
        {
            anim.SetBool("IsNoInput", true);
			anim.SetBool("IsCharging", false);
            anim.SetBool("IsAttacking", false);
        }
		
		
		
		if (anim.GetBool("IsAttacking") == true)
		{
		
		
		cc.enabled = true;
		
		}
		if (anim.GetBool("IsAttacking") == false)
		{
		cc.enabled = false; 
		}
		
		
     }
		
		
    public void ActiveCollider(int active)
    {
        if (active == 0)
            cc.enabled = false;
        else
            cc.enabled = true;
    }

   }

This current code has the charging animation play, but it stops at the last frame and doesn’t move on to the attack animation. If it helps at all the charging animation is .708 seconds long.

I wonder if animation events are your best bet here.

You basically would have function(s) to disable/enable the collider. In your animation for charging you set up an event to call the function for disabling. In your animation for attacking, you set up an event to call the function for enabling.

That may work.

https://docs.unity3d.com/Manual/animeditor-AnimationEvents.html

These events can also be good for switching animations too, like you could put an event right at the end of charging animation that turns the charging animation parameter off and the attack animation on (if mouse is held down, I think you’d want to put)