I’m making a Unity 2D game, but for some reason the Input System is not working properly. My Code contains something like this:
float X = Input.GetAxis("Horizontal") * speed;
float Y = Input.GetAxis("Vertical") * speed;
But for some reason, instead of working the Input working normally, it constantly gives me this output: X: 3.5, Y: -3.5
(just so you know, I multiplied it by the speed of 3.5.)
Does anybody know why this isn’t working??
P.S. When I do hit A or D the direction does change after a bit of thinking, but it’s extremely weird and it never stops, it always goes into a direction. Same goes for W and S.
We need to see more than just those lines because on their own there’s nothing wrong with them. Additionally what are your settings in the Input Manager?
Yes, my gravity is in fact at 3. Also, an important thing is that the player is a child of a rocket ship (which has a rigidbody2D, but i don’t think that matters).
Edit: I set the gravity to 0, and it did solve a bit of the problem, but now, for example if i move right and then release the key, the player will still move.