I recently reimported an FPS shooter I was working on and noticed that my character was automatically moving without any keyboard inputs.
So I did some debugging and realized that Input.GetAxis("Horizontal) was returning -1 and Input.GetAxis("Vertical") was returning 1 even when nothing was being inputted. However when the application isn’t in focus, both axes return 0. I have switched keyboards and I’m still facing the same issue.
Here is a cutout of my movement code:
float x = Input.GetAxis("Horizontal");
float z = Input.GetAxis("Vertical");
Debug.Log(x);
Debug.Log(z);
//Move character controller
controller.Move(move * speed * Time.deltaTime);
//Apply gravity
velocity.y += gravity * 2.5f * Time.deltaTime;
controller.Move(velocity * Time.deltaTime);
Please help!
Are there any other input devices connected to your computer that are being recognized as a sort of "game controller"? It could be unexpected/erroneous input being provided in that manner. <i>Edit: Also, for reference, your "cutout" doesn't actually mention where "x" and "z" are used. Are they a part of your "move" variable?</i>
– Eno-Khaon