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 Common_Horse · May 27, 2012 at 01:49 AM · inputinput.getaxisdefinitions

`Input' does not contain a definition for `GetAxis'

Hello everyone!

I have been a unity3D user for several years now, and I have developed a decent ability with C# scripting inside the engine.

Just recently, I have encountered this error while scripting:

'Input' does not contain a definition for 'GetAxis'

The same goes for any other input definitions.

I have no clue what is wrong. When using MonoDevelop, the only definitions available in Input are those that belong to Object/GameObject.

I am sure that this isn't a problem with any script I have, as it is currently just a copy of an example from the scripting reference, additionally, the script was working fine for several test beforehand.

Any tips would be greatly appreciated!

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
1
Best Answer

Answer by Eric5h5 · May 27, 2012 at 02:23 AM

Don't name your classes the same thing as Unity classes. (Well, you can, but if you do that then you have to specify which one you mean every time, which is a bit annoying.)

Comment
Add comment · Show 7 · 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 Common_Horse · May 27, 2012 at 02:38 AM 0
Share

I haven't been na$$anonymous$$g any custom definitions if that's what you mean. The script was working fine before this happened, and it is not giving errors in any other projects.

avatar image whydoidoit · May 27, 2012 at 02:40 AM 0
Share

Creating a javascript with the name Input would do the same thing, it makes a class called Input.

avatar image Eric5h5 · May 27, 2012 at 02:59 AM 0
Share

You made a class called Input, which doesn't have a GetAxis function, so when you say "Input.GetAxis", Unity looks in your Input class and doesn't find any GetAxis function, and complains. You can differentiate by saying "UnityEngine.Input", but as I said, it's better just to not do that.

avatar image Common_Horse · May 27, 2012 at 03:15 AM 0
Share

Ahh, well I'm not doing that either. I haven't made any custom classes. I'm simply calling:

float example = Input.GetAxis("Vertical");

or

bool example = Input.GetAxis("Jump");

which is giving the aforementioned error

avatar image whydoidoit · May 27, 2012 at 03:21 AM 0
Share

To be clear - you haven't made a script called Input in Javascript? It's got to be that or the fact you have created a variable called Input which is of type GameObject.

Show more comments
avatar image
1

Answer by arcade82 · Nov 08, 2014 at 03:41 AM

For anybody else, who maybe more recently than 2 years ago encountered this problem. I just fixed mine with: changing float moveHorizontal = Input.getAxis("Horizontal"); to

{ float moveHorizontal = UnityEngine.Input.GetAxis("Horizontal"); }

It doens't recognize the getAxis without a CAPital G and it doesn't recognize the Input without UnityEngine attached.

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 Eric5h5 · Nov 08, 2014 at 04:07 AM 0
Share

You would never use getAxis anyway since functions are always capitalized. But yes, doing this is exactly what I said to do in my answer. All of this has already been explained (read the comments).

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

7 People are following this question.

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

Related Questions

How to set(raw) 'horizontal' input axis value in script 1 Answer

Why does InputManager have multiple axes with the same name? 1 Answer

How to get overall intensity for each Joystick Axis? 4 Answers

input resets after scene change,Held Down Input not responding after scene change. 0 Answers

How to convert Input.GetAxis to Accelerometer control? 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