How to resume animation where it left off?

I am making a first person shooter game in unity. I have a bar on the top of the screen that is equal to the number of bullets in the gun. Problem is, When I shoot a bullet, I want the bar to decrease = to the number of bullets shot. I have a decreasing animation that works perfectly. I need to do something like this.

When I shoot the gun, play animation. If Im not shooting, stop animation. If im shooting play animation where it left off.
`

// Checks every frame

void Update ()
{

// Display how much ammo is remaining
text.text = "" + Ammo;

// If the user has pressed spacebar and there are bullets inside the gun,
if(Input.GetKey("space") && Ammo >= 1)
  {

  // Subtract the ammo
		Ammo = Ammo - 1;

  // Play reload stop
  anim.Play("ReloadStop");

  }

// If user is not shooting the gun,
else
{

  // Stop the animation
  anim.Stop("ReloadStop");

}

`

Also, why is my Update function not inside the ?

Enable and disable the animator

I havnt tried this method myself, though you could try tracking the time of the animation before stopping it and storing it in a private float variable, then use “anim.time = TheLastTime;”, then use “anim.Play();”.

i know its late in case if someone is still looking here is the way you can do it…

public Animator Anim;

void Start()
{
    Anim.speed = 1;
  
    
}


void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        Anim.speed = 0;//pause the animation
       
    }
    if (Input.GetKeyDown(KeyCode.A))
    {
        Anim.speed = 1;//resume the animation
      
    }
}