I see it’s recommended to use GetAxis over GetKey… But in my 2D game the former results in very floaty/slide-y left and right movement of the player sprite when using a keyboard (and I imagine a digital D-pad).
Is there a way to tighten up GetAxis to work as I expect? (More like the binary full-on/full-off of GetKey)
Thanks.
You could certainly just treat the value absolutely
float h = Input.GetAxis("Horizontal");
if (h > 0)
MoveRight();
else if (h < 0)
MoveLeft();
Change the settings in the input manager so the behavior is what you want.
–Eric
This results in the “floaty” problem I described 
I’ve found I can set Gravity and Sensitivity to some arbitrarily high value so it’s full-on 1, 0, -1 in less than an update timeframe … But that feels a bit messy… e.g: whats a good number, will this have an undesirable effect on analogue or touch input, etc.
Well, touch input doesn’t use Input.GetAxis, and analog and digital controls are inherently different so should be programmed separately anyway.
–Eric
Just use Input.GetAxisRaw(“Horizontal”);
It’s because GetAxis tries to smoothify transition between Axis positions
4 Likes
THIS is the answer ^^. Thank you Oxay 