Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
13
Question by LeftyTwoGuns · Jun 17, 2014 at 07:02 AM · inputgetaxis

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
21

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image LeftyTwoGuns · Jun 17, 2014 at 03:39 PM 0
Share

Thanks, I just wanted to be sure. $$anonymous$$ost of the examples I've seen for GetAxisRaw were 2D games

avatar image
1

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; }

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tanoshimi · Oct 29, 2015 at 11:50 PM 0
Share

How can "pause" be an axis?

avatar image ulissescad tanoshimi · Oct 30, 2015 at 12:22 AM 0
Share

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.

avatar image RLin · Oct 29, 2015 at 11:54 PM 0
Share

I would assume it's a custom axis he created himself.

avatar image ulissescad RLin · Oct 30, 2015 at 12:22 AM 0
Share

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.

avatar image AndrewBilotti · Jan 06, 2016 at 08:35 PM 0
Share

+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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

25 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges