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!