Input.GetAxis not returning 0 when keyboard is idle

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!

Do you have any type of joystick connected to your PC? By default, this is not only keyboard but also mouse and joystick input.

In my case i’m receiving wrong values with both 2020 & 2021 without any device connected, BT is down, no connection to any device. Dunno how to fix it.

I have the similar situation as you. Although I did not connect any Joystick, I saw a VJoy Virtual Joystick in my device manager. I solved the problem by disabling it. Maybe you can check if you have a similar virtual Joystick installed.