Question by
arubin6 · Oct 19, 2019 at 05:20 PM ·
animationmovement3dif-statements
Play animation when WASD is pressed, stop animation when none of them are pressed (Help!!)
if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D))
{
anim.SetInteger(HashIDs.jogCond_Int, 1);
}
else if(!(Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D)))
{
anim.SetInteger(HashIDs.jogCond_Int, 0);
}
This is what I have right now, but it doesn't work. The run animation just plays for a second then stops. I only have one animation for movement rn, and I wanted to play when the user presses WASD (or statement) and stop when none of them are being pressed.
Comment