Possible issue related to Input.GetAxis("Horizontal") and Input.GetAxisRaw("Horizontal")!?

Hi.

I’m just wondering about the following simple code and if Input.GetAxisRaw(“Horizontal”) should default to 0. I keep getting -1 by default. Is there an issue with the code or Input.GetAxisRaw()? I get the same results with Input.GetAxis()

using UnityEngine;

public class Proto2PlayerController : MonoBehaviour
{
    public float horizontalInput;
   
    // Update is called once per frame
    void Update()
    {
        horizontalInput = Input.GetAxisRaw("Horizontal"); // Defaults to -1   BUG?
    }
}

I’m currently using Unity 2021.3.16.f

Thanks for any feedback :0)

Often this comes from you having left an input device plugged into your computer and forgetting about it. For example a gamepad lying upside down leaning on its joystick.

Thanks.
I tried to disconnect all devices connected to the computer, but the issue was still there.

Ended up with this workaround.

using UnityEngine;
public class Proto2PlayerController : MonoBehaviour
{
    public float horizontalInput;
 
    // Update is called once per frame
    void Update()
    {
        horizontalInput = 0f;
        if (Input.GetButton("Horizontal"))
        {
            horizontalInput = Input.GetAxisRaw("Horizontal"); // Defaults to -1   BUG?
        }
    }
}