Hi, This has been bugging me for a long time maybe you can help :) Okay so i have 3 animations (Idle,(ShootandReload << its all one animation because its a bolt action rifle),and walk,,, This is my code
function Update ()
But when i have the Idle piece of code in there it goes messed up because the shoot/Reload doesn't run through the hole animation if you need more infomation check out this link to see what i meen :)
Watch this video to see more :)
You may want to rethink your logic. GetKey Returns true while the user holds down the key identified by name. So that means, if you fire, you typically will quickly press the "mouse 0" down and then let it up. When running through the update loop after you shoot, that means your else if statement is then false in the next update cycle, and it will go through the else statement where your idle animation is even though you want your shoot animation to finish.
By definition, CrossFade will IMMEDIATELY crossfade the current playing animation ( shoot ) and fade in the new animation ( idle ), at the default speed since you have not passed in a time value in the animation.CrossFade() arguments. So either you can try using PlayQueued, CrossFadeQueued, or lay out your logic differently to compensate for this change in animation states.
There are several other options that you can go with in animations, it's really an art in-and-of itself. There's blend weights, animation layers, checking if animation.IsPlaying(), and a slew of other things to get to your end point.