New answers tagged

0

If you are polling the keyboard, InputGetAxisRaw will always only return -1, 0 or 1 per the docs. Use InputGetAxis instead, assuming you don't want to do your own smoothing. I've tested your code, zero does get returned when no keys are pressed: Try polling/ logging Input.GetAxis() instead of Input.GetAxisRaw to see what kinds of values your keyboard is ...


2

I had this exact same issue. The problem was that the Unity Editor got into a state where the Player Input component in the inspector was referring to a different instance of the Player than what was in the scene. This was easy to confirm by printing out the hashcode of the GameObject in both the input callback and in the FixedUpdate() block, which showed ...


Top 50 recent answers are included