- Home /
Question by
gw_unity · Sep 14, 2018 at 02:08 AM ·
c#animationtransition
How do I make it so I can hold down w and shift and it makes an transition to my running animation and when I let go it stops the animation
My code works by when I press w and shift once it starts playing the animation but wont stop I want it so I have to hold down shift and W and when I stop holding down it goes to idle or another animation. I tried Getkeydown and getkeyup but it doesn't work. private bool Running = false;
void Update()
{
if (Input.GetButton("Fire3") && Input.GetButton("Vertical"))
{
Running = true;
animator.SetBool("isRunning", Running);
}
else if (Input.GetButton("Fire3") && Input.GetButton("Vertical"))
{
Running = false;
animator.SetBool("isRunning", Running);
}
}
}
Comment