How to animate prefabs that are instantiated during runtime

I’m creating a basic fps type game. The idea is, the player starts the game with a gun, all the positioning of the gun I’ve already sorted out.

The player is able to go and pick up another gun and cycle between weapons, like Black Ops. The reload mechanisms and switching is already coded.

What I’m trying to do now is add animation, so that when the player reloads their weapon it plays an animation of the gun reloading. I should note, the player is not animated in anyway, just the weapon. I tried adding an animator controller to the prefabs of the weapons including the reload animation. I set up transition states between Idle and Reloading with a boolean condition. On the transition Idle>Reload IsReloading has to be true and Reload>Idle IsReloading has to be false.

Whenever I create the animator controller for the weapon unity is spitting out a message saying "The Animator Controller (Gun) you have used is not valid. Animations will not play. I’m not sure if its because the weapon is a prefab and is being instantiated or what. So usually if I add these animations the reload animation will play once then never again even when setting the boolean to true in my code. I can’t figure out the issue and searched everywhere online but I can’t make sense of it.

This is a snippet of code. Basically after the reload checks are done then it goes to this function to play the animation. But as I’ve said won’t play.

void ReloadAnimationCheck()
        animator.SetBool("IsReloading", true);
        logicManager.TotalBullets -= logicManager.AmountToTake;
        logicManager.BulletsInChamber += logicManager.AmountToAdd;