I have a script for playing animations upon pressing keys. But for some reason when I added the jump animation to the script, the walk animation stops working altogether. Also for the Jump animation, I would like for it to finish playing even after I stop pressing the space bar. I’m not sure how I would do this. The script is below.
function Update() {
var walk = Input.GetKey( "w" );
var jump = Input.GetKey( "space" );
var idle = AnimationClip;
if( walk ) {
animation.Play( "Walk" );
}
if( jump ) {
animation.Play( "Jump" );
}
else animation.Play( "Idle" );
}