- Home /
Stop animation after played 30 times?
I have recently modelled an M16 Carbine texture rigged and animated it in blender and then imported it into unity and wrote a simple script which plays its animations when certain keys are pressed. I also have a script attached to a cube in front of my gun which when the LMB is held down shoots raycasts. All of this works perfectly apart from one thing, when I hold down the LMB the cube in front of my gun runs out of ammo and you need to reload but my guns shoot animation still plays, how would I go about stopping my gun from shooting when my gun has ran out of ammo?
check how many ammo you got left if(ammo!=0){animation.Play("GunShooting");} then if you run out of ammo the naimation won't start.
Your answer
Follow this Question
Related Questions
Animation On Mouse Click 1 Answer
Blender animation 1 Answer
Animation Problems 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Animation Triggers? 1 Answer