Animation Script Help

Hi! Here is my animation script—>

function Update () {

if (Input.GetButton(“Jump”))

animation.CrossFade (“Jump”);


animation.CrossFade (“Walk”);


It works really well, but my problem with it is that it plays as long as you have the jump button pushed down. I would like it so that you just press the button once and the animation plays till it’s done. How would I do that? Do I need an extra line of code? Thanks for reading!

You probably want to use GetButtonUp instead of just GetButton, that way it’s only called when the button is released.