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
2
Question by HLorenzi · Jun 23, 2015 at 02:43 PM · c#inputaxis

Can Input.GetAxis be used without assigning via the Input Manager?

I would like to query input state programatically; the Input Manager in the Editor is pretty much useless in my game.

I can do it already for keyboard/controller keys (via Input.GetKey(KeyCode.Whatever)), mouse, and touch. But it doesn't seem to be possible to do the same for joystick axes. For example, there's no Input.GetAxis(KeyCode.Joystick1Axis2).

I can't find any information on this, but it is the only thing that is missing for me to bypass the Input Manager entirely. I'm perfectly happy to handle input in my own code, and I need key bindings/handling to be flexible. I would prefer not to use other input managers from the Asset Store.

Did I miss something? How can I query axes programatically (i.e. by not using the Input Manager bindings)?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Sisso · Jun 23, 2015 at 03:07 PM

Answer:

I don't think so.

Workaround:

A engine provide a lot of tools to help you, try to bypass generally cause more frustration that learn how to use. Input Manager is how you configure inputs in your game.

Simple add all the inputs that you will need in input manager for each joystick and namely how do you desire, like "Joystick1Axis2".

Later in code you access like Input.GetAxisRaw("Joystick1Axis2") or Input.GetAxis("Joystick1Axis2")

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 HLorenzi · Jun 23, 2015 at 03:40 PM 1
Share

It does seem to be the case that it's not possible, but that is just ridiculous from the engine developers' AND game developers' standpoint. Unfortunately, I really cannot use the default Input $$anonymous$$anager because it does not even allow(!) rebinding keys at runtime (and that's just basic functionality from many commercial games). Also, there are some input methods the Input $$anonymous$$anager can't seem to even handle easily (like using the analog trigger on an Xbox controller as a binary button). Not to mention, it's dreadful having to set up bindings that way for each button of each of the 4 controllers in a multiplayer game.

avatar image Sisso · Jun 23, 2015 at 05:04 PM 0
Share

Yes, it is very outdated. This Input$$anonymous$$anage come from the first versions, Input are complex and difficult to find a soltion for everybody, so nobody touch it anymore :P

Think it as a bootstrap or data configuration (like specify that joy1 is the same input that keyboard). But you need to do everything else you do in your own Input layer, like probably you are already doing, simple need to add the joystick axis.

Boring? For sure, but is 10 $$anonymous$$utes lost one time.

avatar image tiagorpg Sisso · Sep 25, 2020 at 02:25 AM 0
Share

one time for every game, there is not even a way to copy+paste the input and make it a standard to use in all games, that is exactly why i was making a custom input in the first place, to allow players to make as many different settings as they want

avatar image HLorenzi · Jun 23, 2015 at 06:25 PM 0
Share

Yeah, I guess setting up all the axes (but not other keys) at the Input $$anonymous$$anager is the solution right now. What does every Input $$anonymous$$anager from the Asset Store do? Use external DLLs? I've seen some that do not support all the platforms we're running the game in. That should ideally come from the Unity developers themselves. (Well, if they had just added that one little function, there'd be no headaches now, at least for me)

avatar image Sisso · Jun 23, 2015 at 07:16 PM 0
Share

I never use one of them. But I think that they could directly access low level API to bypass unity.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

C# HUD axis button display 0 Answers

Detect Gyroscope's rotation around a single axis? Like a car game. 0 Answers

Distribute terrain in zones 3 Answers

Htc Vive can't get axis from touchpad input 2 Answers

how to get the negative of an input Axis? 1 Answer


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