- Home /
input.GetAxis (float) not working, but Raw works.
I have been scratching my head for a while on this one: My Input.GetAxis is not working. I have hit reset in the Input Manager, and renamed the duplicates of Horizontal and Vertical to HorizontalJoy and VerticalJoy, but that was not the problem.
here's a simple example script that only prints "0" in my console, when I have the program running and press a or d or left arrow or right arrow... i know it is supposed to be a float value between -1 and 1 (returning to 0 if not pressed).
function Update () {
Debug.Log (Input.GetAxis("Horizontal"));
}
If I change it to "Vertical" same thing... it will only print "0".
But, if I add "Raw" , Input.GetAxisRaw("Horizontal"), then yes it does show, -1, 0, and 1, if I press a, or d, or arrow keys. So this proves the program is running, and it CAN read the keyboard,; it just does not want to give me the float values of GetAxis.
I'm ungraded to 5.1.2.
Please help if you have any ideas. if I cant figure this out I'm stuck with integers of -1, 0 or 1 for movement.
Answer by Michio-Magic · Aug 13, 2015 at 08:10 PM
It's still a mystery why it did not work in my first project. After making an all NEW project, the Input.GetAxis worked fine... so if you have this problem i guess that is the answer.
Unfortunately, I had to rebuild my entire OLD project into the NEW project.