Problems with horizontal input. 0 and -1 both= false.

My object rotates and transform perfectly when I use getkey and press right and left. I wanted to switch to Unity’s input feature so I could have the novelty of using a 360 controller. So choosing the Horizontal, I made it so that positive=right and negative=left. As I read in the reference. The horizontal axis will give from -1 to 1 and 0 is neutral. When I run this, My object starts turning left. Which means its already false which suggests that 0=false. And since Getbutton is giving me a boolean, I am not sure how I can have the game know the difference between no input and negative input. Do I have to adjust the sensitivity? To clarify, the commented out getkeys work and I am sure I could just add an “or” to each if statement and find and input the joy button for the 360 controller but that is not elegant.


The code here is obviously wrong because you are comparing Input.GetButton(“Horizontal”) to ‘true’ rather than using values in the -1 to 1 range. Assuming you don’t want a range of values, but just true/false, just do something like:

if(Input.GetButton("Horizontal") < -.1)

If you are using a joystick and your character is walking with a dead stick, consider upping the Dead setting for “Horizontal”. Go to Edit/Project Settings Input.