Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
3
Question by thedrok_ · Mar 22, 2018 at 06:32 PM · controllermappingxboxplaystation

How to map controls for any controller.

Hello, As the title states i would like to know how to map my games controls to any controller. By this i mean how can i compensate for that fact that on a ps4 controller up and down on the left hand stick is the X Axis while on a xbox controller it is the Y Axis. Is this even possible?

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

3 Replies

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

Answer by ArcadeRoyal · Mar 22, 2018 at 11:55 PM

I'm not sure about any possible controller out there, but at the very least for PS4 and XB controllers, the default unity input settings should work pretty well. I am not sure what's causing you to see the X/Y Axis mismatch between the controller types, but that's not how the unity input is set up by default - on both the PS4 and XB controllers, the button with the "X Axis" label is the left-stick horizontal axis, and the "Y Axis" label is the left-stick vertical axis.

This graphic (courtesy Jimmy Vegas - source http://www.jvunity.weebly.com/uploads/4/7/6/0/47606749/controlmap.png) is useful in knowing the button labels to match up with Inputs. The labels correspond very closely between the two controller types.

alt text
Just to ensure this was accurate, I tried plugging both an XB and PS4 controller in and using both on a my project, and both responded identically using the default unity Input setup. Is it possible that your input settings of your project have gotten mangled? You can check this by going Edit > Project Settings > Input in unity. I've included an example of what they look like by default, with the horizontal and vertical controller setups expanded for details. I'd double-check your project against that just to make sure it all lines up.

alt text
As for other controllers, I'm not sure - I imagine unity's support varies from controller to controller, I doubt there is one single sure-fire way to support every one. PS4 and XB controllers are going to be the vast majority of your install base. If you're going for non-standard controllers, you might check the Asset store? I know for instance there is a package that lets you get input from a Wii remote via bluetooth on there - possibly there are others for the controller you're interested in?


capture.png (42.1 kB)
controlmap.png (442.8 kB)
Comment
Add comment · Show 2 · 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 thedrok_ · Mar 23, 2018 at 12:23 PM 0
Share

Huh thats odd i specifically remember them not being the same and i searched for the mappings on google and it said that they had different mappings. $$anonymous$$aybe it got changed or i am just massively mistaken. Thank you for your in depth answer.

avatar image homer_3 · Jun 05, 2020 at 08:52 PM 0
Share

The Jimmy Vegas mapping image does not appear to be correct for the right stick. Right stick horizontal is 3rd axis and vertical is 6th.

avatar image
1

Answer by BlueBananaProductions · Feb 02, 2020 at 10:12 PM

I have an Xbox One controller which seems to have the same mapping as the "Jimmy Vegas" picture above. But the image is not accurate, at least for the PS4. For example, on PS4, X is button 1, not zero, and R2 is 3rd Axis or 7th button. Use this for PS4: https://www.reddit.com/r/Unity3D/comments/1syswe/ps4_controller_map_for_unity/

However I think the bigger issue is that two controllers with similar physical layouts and shared button index number or axis numbers might have conflicting mappings. "X" is button 1 for a PS4 controller, and "A" is button 0 for an Xbox controller, so if you want a game to have X and A do the same thing (because the user might be playing it through Steam, say, with one of the two controllers, and in terms of physically position on the controller these buttons correspond) how do you do it? With Unity's input system it doesn't seem possible, because you'd end up with a configuration where both X and and Square (via PS4 controller, inputs 0 and 1) do the same thing (in game), while also both A and B (on Xbox controller, inputs 0 and 1) also do the same thing.

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 ArthyShow · Apr 24, 2020 at 02:04 PM 0
Share

Best solution I found is to map both separately, like PS4_Action=1 and Xbox_Action=0. Then use a static Script for "InputSettings" who will provide public property like InputSettings.Action base on "if you are playing with an PS4 or Xbox Controller". Finally use this property on your code to catch inputs.

avatar image
0

Answer by Juandapp · Nov 11, 2021 at 01:31 PM

The mapping of the images given by the user above is accurate if you program for each of those controls, otherwise on Windows at least the one for PS4 is wrong.

Comment
Add comment · 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

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

85 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Controller mapping PLEASE HELP!! 2 Answers

How to detect if its a X360 or Ps3 controller that is connected. 1 Answer

Xbox controller player slowly moves 1 Answer

Xbox Controller ObjectArray Scripting Error 1 Answer

Split-Screen with 2 Xbox 360 Controllers Input help 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