Play Specific Animations of an Object

Hi everybody, I’ve been messing with Unity a little but I’m still new to it. I’m trying to make this gun game where I made a modeled and animated machine pistol that I want it to play the shooting animation when mouse is clicked. I have it set to that part, but how do I play the animation when it needs to reload? I don’t want it to intersect with the shooting animation. I also, BTW, have the animation split up so that it will work. The shooting animation is basically named “shoot”, and the reloading is “reload”. So… how do I do it? Anyone help me please?

You’ve got lots of choices :slight_smile:

You can animation.CrossFade(“reload”) which will blend one into the other. Then cross fade them back.

You can stop the shoot animation and just play reload: animation.Play(“reload”)

You can put them on different layers (so reload is higher than shoot) then animation.Play(“reload”) will take over from the shooting and then go back when it stops (presuming its set to Once).

You can get the individual animation states by doing animation[“youranim”] and set the weight, the speed and whether it is enabled for each animation separately.