if (Input.GetKeyDown("w")) Not working

Hello, I tried to make a code for my animations and I wrote this:

if (Input.GetKeyDown(“w”))

Technically it all worked BUT when i press W and then for example A while pressing W i let go from A and it send me back to idle state but i was still pressing W, is there a way to make it properly like in actual games?

I don’t have a fix for this particular problem but there is a workaround that would be more performant and in most ways just better, Input.GetAxis.

here is some code from a project of mine

Vector2 input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

//rb is a Rigidbody2D;
rb.velocity = input*movementSpeed;

then you can for example use a blend tree to have smooth animations, or if that is too much work
just use

if(rb.velocity != new Vector2(0, 0))