Mecanim restricting animation problem

I have a gun model with a shoot, idle and reload animation. I’ve made it so that when you’re reloading, you can’t shoot. I want to make it so that if you reload while the shooting animation is ongoing, it’ll stop shooting and start reloading. My problem is that it’s doing that, but the reload animation doesn’t finish. Right now, it starts the reloading animation, the animation plays for about 0.3 seconds, then it goes back to shooting. Here’s my state machine: Imgur: The magic of the Internet And here is my script:

currentBaseState = anim.GetCurrentAnimatorStateInfo(0);
 
       if(canShoot  Ammunition > 0)
       {
         if(Input.GetButton("Fire1"))
         {
          anim.SetBool("Shot",true);
          Shoot();
         }
       }
       if(currentBaseState.nameHash == shootState)
        {
           anim.SetBool("Shot", false);
           MuzzleFlashRenderer.enabled = false;
          ShootLight.enabled = false;
        }
 
       if(Input.GetButtonDown("Reload")  Clips > 0)
       {
         anim.SetBool("Reload",true);
         Reload();
       }
       if(currentBaseState.nameHash == reloadState)
       {
         anim.SetBool("Reload",false);
         canShoot = false;
       }
       if(currentBaseState.nameHash == idleState)
       {
         canShoot = true; 
       }

I’ve had some luck by putting a canShoot = false; statement like so:

if(Input.GetButtonDown("Reload")  Clips > 0)
       {
         canShoot = false;
         anim.SetBool("Reload",true);
         Reload();
       }

But it only works 1/3th of the time.

Do you have any transitions that are flagged as “atomic”? The “atomic” flag means “cannot be interrupted” so the animation plays all the way through. This also affects detecting and processing any variables that control state changes.