- Home /
Difference between Input.GetAxis and GetAxisRaw?
I've done some reading and from what I can gather, where GetAxis will have the input increase/decrease gradually, GetAxisRaw will hit -1/1 instantly, just the same as GetButton...do I have that right?
What are some specfic scenarios where GetAxisRaw would be ideal over GetAxis?
Answer by tanoshimi · Jun 17, 2014 at 10:58 AM
Yes - your understanding is correct - the result of GetAxis() is smoothed based on the "sensitivity" setting so that value gradually changes from 0 to 1, or 0 to -1. Whereas GetAxisRaw will only ever return 0, -1, or 1 exactly (assuming a digital input such as a keyboard or joystick button).
Specific scenarios to use GetAxisRaw? Well, when you don't want the input to be smoothed but to immediately reflect the actual input. I think it's more common for 2D games to use raw input and 3D games to have smoothing, but that's purely anecdotal - you just need to choose the method that fits your game.
Thanks, I just wanted to be sure. $$anonymous$$ost of the examples I've seen for GetAxisRaw were 2D games
Answer by ulissescad · Oct 29, 2015 at 08:30 PM
Hello, I found by chance a difference between getaxis and getaxisraw, is very useful to monitor the status and pause the game, because in my case as paused using the time.scale == 0 getaxis the button no longer responds, as the axisraw kept his Function. After trying to solve the most diverse way possible just moved to axisraw and went on to work properly. Below is my pause method is not complicated and it works well.
if (Input.GetAxisRaw ("Pause")> 0) { if (Inp == 0) { if (Pause == false) { Pause = true; } else { Pause = false; } } Inp = 1;
} Else { Inp = 0; } Debug.log (InP);
if (Pause) {
Time.timeScale = 0; ObjCanvasPause.SetActive (true); // Inp = 0; } Else {
ObjCanvasPause.SetActive (false); Time.timeScale = 1; }
Whenever used the input.getaxis by this return a float and not a bool state not preserved. I used the INP to ensure only a change of state by interaction, and axisraw order to cause the INP value back to 0 as soon as the button was no longer depressed. input.getaxis stands when using time.timescale == 0, then was not for me. Pause is an axis created from the edit> ProjectSettings> input. It should not be the best solution, but it was that I found to the problem after much searching and finding nothing.
Whenever used the input.getaxis by this return a float and not a bool state not preserved. I used the INP to ensure only a change of state by interaction, and axisraw order to cause the INP value back to 0 as soon as the button was no longer depressed. input.getaxis stands when using time.timescale == 0, then was not for me. Pause is an axis created from the edit> ProjectSettings> input. It should not be the best solution, but it was that I found to the problem after much searching and finding nothing.
+1! I have been browsing Unity Answers all day to find this! now when I press esc the second time, I unpause the game :D
Your answer
Follow this Question
Related Questions
Problem with a custom input handler 1 Answer
Steering Wheel / joystick GetAxis trouble 0 Answers
How can I prevent Input.GetAxis from sporadically reporting deltas of 0.0? 0 Answers
Windows 8 touch equivalent for 'Input.GetAxis("Mouse X")' 2 Answers
Is there a way to manually change the Input.Axis values? 2 Answers