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
0
Question by raj421 · Mar 17, 2013 at 06:12 AM · input.getaxis

Input.GetAxis always return 0

I have the following piece of code that am running on my Mac Pro with trail version of Unity 4. I am quite new to unity and game programming and maybe am missing something very obvious so any help is greatly appreciated.

 function Update () {
         Debug.Log("X=" + Input.GetAxis("Horizontal") + " Y=" + Input.GetAxis("Vertical"));
     }

Both horizontal and vertical axis always return zero. Below, I have an image of my input manager.

Thanks!

alt text

screenshot_3_17_13_1_39_am-3.png (46.5 kB)
Comment
Add comment · Show 3
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 Arithan · Mar 17, 2013 at 07:30 AM 0
Share

$$anonymous$$ind of a dumb question for me to ask, but just to make sure, are you actually pressing the keys you have set up for Horizontal? And are you pressing them after you've already hit the Play button? Also, is the script attached to your character?

avatar image raj421 · Mar 17, 2013 at 02:16 PM 0
Share

Yes, I am pressing the left & the right arrow after I hit the play button. The script is attached to my main camera. Thanks

avatar image JoeStrout · Apr 08, 2015 at 07:08 PM 0
Share

Did you ever figure this out?

1 Reply

· Add your reply
  • Sort: 
avatar image
4

Answer by TonyLi · Oct 24, 2013 at 02:07 AM

Sorry for reviving an old question, but I thought I'd share the answer for a similar problem I just encountered.

I imported Azuline Studios' Realistic FPS Prefab into a project, and it added tags, layers, and who knows what else. But, pertinent to this question, it also added two additional InputManager Axes named "Vertical" and "Horizontal" that weren't assigned any keys. These were in addition to the existing "Vertical" and "Horizontal" that the project had by default.

These caused Input.GetAxis("Vertical") to always return zero, which broke my project until I removed the duplicates.

Comment
Add comment · Show 3 · 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 vivaldi2232 · Apr 14, 2015 at 04:56 PM 0
Share

Thanks! This helped me a lot!!!

avatar image $$anonymous$$ · Apr 24, 2017 at 07:52 AM 0
Share

I had some $$anonymous$$aterial/Prefabs applied to my Player who was using Input.GetAxis("Horizontal") and i dont know what it basically done, but after deleting them, it started working. I hope your comment is reason behind that.

avatar image abandon_games · May 24, 2021 at 07:05 PM 0
Share

had the same issue with a different package - it changed the Axis tags for horizontal and vertical movement...

lesson learned: check your Input Manager (in Project Settings) and ensure the Axis tags you're referencing actually exist

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

16 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

Related Questions

Touch to turn wheelcolllider.steerAngle with limits 1 Answer

Making a Paddle Move Vertically? 1 Answer

Input.GetAxisRaw with delete and shift 0 Answers

GameController Unity wrong Axis-Values 0 Answers

How Do I Snap Input Between 1, 0, and -1 0 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