• 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 /
  • Help Room /
avatar image
0
Question by LexDeKogel · Apr 22, 2019 at 11:58 AM · inputbugcontrollerjoystickstartup

Contollers are unusable when already plugged in when starting build/editor

I've wasted way too much time on this problem so I really hope someone can help! I'm working on a game that uses 2 local controllers, I've been having a problem where sometimes a controller will only update if on that same frame the other controller also updates. The unity input manager is a big blackbox to me so idk what is actually happening, but I've written some pseudo code to show how it roughly seems to work.

  void UpdateControllerInput(int controllerIndex)
  {
        if(CheckIfAnythingChanged(PortListA[controllerIndex]))
        {
             ActuallyUpdateControllerInput(PortListB[controllerIndex]);
        }
  }

Where PortListA and PortListB both point to the input values of the controllers and these lists are normally the same but sometimes they are not. So for example the first and second values of PortListA are flipped in PortListB sometimes.

The inputs don't have to be related in any way, for example if I hold a direction with controller 1 nothing happens, then I press the A button with controller 2 (which is not even used at all in my game) then the direction input of controller 1 will suddenly be read and it will be stuck on that value until I release A (or make the input on controller 2 different in any other arbitrary way) which will again update controller 2.

I've replicated the problem with the newest version of unity (2019.1.0f2) with the following as the only code in the scene:

 using UnityEngine;

 public class ControllerTest : MonoBehaviour
 {
     void Update()
     {
         for (int n = 1; n < 9; n++)
             for (int i = 0; i < 20; i++)
             {
                 if (Input.GetKeyDown("joystick " + n + " button " + i))
                     Debug.Log("Joystick" + n + "Button" + i);
             }
         for (int i = 0; i < 20; i++)
             if (Input.GetKeyDown("joystick button " + i))
                 Debug.Log("Joystick" + "Button" + i);
     }
 }

It will only print an input of the other controller if the other controllers input is also changed that frame. (stick slightly moves, or button is pressed/released)

Now the problem seems to pretty consistently happen if the controllers are already plugged in before starting the editor, and it seems unlikely to happen if you plug them in afterwards. I think there are also some other factors involved for when it does/doesn't happen such as going into sleep mode or playing another game for example, but I'm not entirely sure since it's all very time consuming to test. If it was only the editor I suppose I would be able to live with it (eventhough it would still be very annoying), however it also happens in my builds. I feel like I've tried everything and I really have no idea how to fix it, it seems to me like it's just a problem with Unity, but then it's strange that no one else seems to be having this issue for as far as I can find online. Any help would be appreciated.

Some additional info: I'm using a windows 10 laptop with 2 first party xbox 360 controllers. I never have these problems when playing any other games, so I'm pretty much 100% sure the problem is with Unity somehow.

Edit: I tested it on both my desktop and my laptop and both have the same problem. I can't imagine I'm the only one with this problem but somehow I seem to be.

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 LexDeKogel · May 05, 2019 at 04:35 PM 0
Share

Update: I have 'fixed' the issue by buying Rewired from the asset store. It's pretty clearly a problem with Unity's input system, if anyone has the same issue I think you have 2 options: 1 Buy rewired (or something similar) from the asset store. 2 Wait for Unity's new input system/use the beta version. At the time of writing this that should be finished in a couple of months.

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

200 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 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 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

Xbox Controller Input doesn't always go back to 0 1 Answer

Unity thinks I'm holding up and left on a joystick 3 Answers

How can I listen for input from all joystick axes through c sharp code? 0 Answers

Getting Raw Input Data From Controller 0 Answers

Steam Controller Not Registering as a Joystick 3 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