• 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 CrocsxG · Jan 15, 2018 at 05:01 PM · inputcontrollerjoystick

Unity only read the first connected Controller's input

Hello,

I am having big trouble with inputs, although I thought having implement all correctly...

Here is my actual problem, I have a simple script that do that just in order to see if the controller works

 public class InputManager : MonoBehaviour
 {
     public const float MAX_CONTROLLER = 2;
     public List<int> assignedController = new List<int>();
     void Update()
     {
         CheckNewController();
     }
 
     void CheckNewController()
     {
         Debug.Log("Joy1Start " +Input.GetButton("Joy1Start"));
         Debug.Log("Joy2Start "+Input.GetButton("Joy2Start"));
         for (var i = 1; i <= MAX_CONTROLLER; i++)
         {
             if (assignedController.Contains(i))
                 continue;
 
             if (Input.GetButton("Joy" + i + "Start"))
             {
                 Debug.Log("Add new player on controller" +i);
                 assignedController.Add(i);
             }
         }
     }


I have my Unity Input setup like t$$anonymous$$s alt text

And a w$$anonymous$$te a black XBOX One controller.

Now, if I put the black controller first then the w$$anonymous$$te, my Debug.Log("Joy2Start ") fire and the other is always false. no matter w$$anonymous$$ch button I press If I do the opposite, and plug the w$$anonymous$$te first, then I have Debug.Log("Joy1Start ")and same Joy2 stay stay false...

I guess I am doing somet$$anonymous$$ng wrong, but I can't see :x

Can you enlighten me ?

Thanks

Comment
Add comment · Show 1
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 agray427 · Jan 15, 2018 at 05:25 PM 0
Share

I don't like using Unity's built-in input system when dealing with multiple controllers. It got to me too when I first started. I came across a plugin when I started called XInputDotNet which is for PC and Xbox 360 controllers. I don't see why it wouldn't work for Xbox One as well. Here is a link: https://github.com/speps/XInputDotNet. It's really well done in my opinion. It does actually use Unity's Input System though, but it handles everything for you.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

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

Related Questions

Getting Raw Joystick Input via Script 1 Answer

Gamepad input, axis OR button 0 Answers

Controlling MouseLook script with keys/joystick 1 Answer

Input not recognized after swapping control devices,Input being ignored (New Input System) 0 Answers

First Person Controller Erratic 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