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 LordZephyr · Jul 20, 2014 at 10:36 PM · iosjoystickverticalhorizontalinput manager

What is the command to use a joystick in the Input Manager?

Hi, I am creating an iOS game that uses a joystick for the third person to move with animation. I have scripts and animations for the character. It works great with the arrow keys but I can't find the actual word or words to use to make the horizontal and vertical movement work with the joystick for iOS in the input manager. I have tried joystick button 0, joystick 1 button 0, I have set up separate axes for the joysticks, I have even tried it with character prefabs supplied by Unity just in case there was a problem with my prefabs. Nothing works. I can get everything to work with the mouse buttons, any keyboard button, or even just mouse movements but not with joysticks. All the commands are put into the horizontal and vertical axes in the input manager. If you know the commands for the joystick prefabs, please tell me. Thank you so much. Tom

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
1

Answer by drex150 · Jul 20, 2014 at 11:20 PM

I'm not 100% sure if this is what you're looking for, but let me know!

As long as you haven't modified the inputs located in Edit > Project Settings > Input they will be their defaults.

To access the defaults you use: Input.GetAxis("Horizontal") and Input.GetAxis("Vertical").

If you look at the list of inputs, you will notice that Horizontal and Vertical are the names of the inputs. Whatever the name is, is what you put in to your script.

For example: Input.GetButton("Fire1") will be the A button on a joystick, the left mouse click, and the ctrl key. All three of those are set up by default in the input for Fire1.

You should always use the inputs instead of hard coding a key because then it's simple to set up key bindings if you want to. Also it's just easier to remember "Fire1" instead of "Key.Code blah blah" haha.

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 LordZephyr · Jul 21, 2014 at 11:21 PM 0
Share

@drex150, you are exactly right with everything you said. The problem is, I need the exact word used to get the signal from the on screen joystick in iOS. For example, when I go to Edit, Project Settings, Input, I get the axes (which is what you said). Within the axes, there is the "Horizontal" and "Vertical" commands that are in the code that is standard. Within the "Horizontal" and "Vertical" axes, there is the "Negative Button" and the "Positive Button" that controls left and right and up and down. Within those four fields are the defaults of "left" and "right" and "up" and "down" for the arrow keys. What I want to do is replace the "left" and "right" inputs in the fields with whatever the proper word(s) are for using the joystick in the iOS. I have tried the left and right mouse buttons and it worked perfectly. I also tried various letters and numbers in substitution for the arrow keys and they worked fine as well. I just don't know what the command words are for the joystick. If you (or someone reading this) could tell me, I would really appreciate it and possibly save the rest of my hair. Thanks so much for your help so far. $$anonymous$$

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

23 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

with a joystick impossible to have horizontal=1 and vertical=1 at the same time 1 Answer

How to detect Double Clicking Horizontal/Vertical Axis on joystick 0 Answers

What is the axis for Controller Triggers? 1 Answer

What is the value of joystick code vertical and horizontal 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