Bullet shooting animation

I have a character, that have a "shoot" animation. The animation take some time, because the character have to aim first, and it "shoots" almost at the end of the animation. I want the bullet to be created at a special frame of the animation, so I have made this script, but it dont work

var bullet : Transform;
var newBullet;
var bullets : int;
bullets = 30;

function FixedUpdate()
{

if(Input.GetButtonDown("Fire1") && bullets > 0 && !animation.IsPlaying("walk"))
{

animation.Stop("stand");
animation.CrossFade("shoot");

}

if(animation["shoot"].time == 86)
{
newBullet = Instantiate(bullet, GameObject.Find("Ref_Weapon").transform.position,transform.rotation);
newBullet.rigidbody.AddForce(transform.forward * 20000);
bullets--;
print("if Done");
}
}

Why is this not working? Is there something wrong with animation["shoot"].time == 86 ?

There are a couple of things that could be wrong. The simplest answer is that your FixedUpdate() is never called exactly when your animationState's time is equal to 86 seconds. Also, depending on your wrapmode, this could also make this only happen once. To fix this, you can check when the time is greater than 86 or something like that and/or changing your update step to make certain that FixedUpdate is called at the intervals you expect and/or using Update in stead of FixedUpdate.

This isn't really the best way to trigger this. You should look into AnimationEvents they are designed for exactly what you're describing, but note that you cannot modify animations that have been imported with a character, etc. For imported animations you can a) duplicate the animations and modify the duplicates (see this question) or b) create a separate animations (with your events) that you trigger to run at the same time on a separate layer. Option a) is the most practiced because option b) is not very extensible.