Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Released] cInput 2 - Unitys custom inputmanager got improved !

Discussion in 'Assets and Asset Store' started by Roidz99, Apr 4, 2012.

  1. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I got an Xbox One controller today. Here are the mappings I'm getting from Unity's default Input Manager:

    Left Stick X: Axis 1 (Right is positive)
    Left Stick Y: Axis 2 (Down)

    Right Stick X: Axis 4 (Right)
    Left Stick Y: Axis 5 (Down)

    Trigger Left: Axis 3 (range of -1 (untouched) to 1 (fully pressed)
    Trigger Right: Axis 6 (range of -1 (untouched) to 1 (fully pressed)

    D-Pad Left/Right: Axis 7 (Right)
    D-Pad Up/Down: Axis 8 (Up)

    All of the buttons seem to be mapped the same way as the Xbox 360 gamepad.

    Like you, I see some discrepancy in how cInput detects the Xbox One gamepad's triggers. Sometimes I get the positive axis, sometimes I get the negative axis, with no obvious pattern as to when it will be one or the other. Though most of the time LT was 3-. RT seems to often map to 6+ the first time, but then change to 6- and keep mapping to 6- on subsequent rebinds...

    Anyway, now that I have the Xbox One gamepad, I can improve cInput's compatibility with it.

    Thanks for bringing these gamepad mapping differences to my attention.
     
  2. SVC-Games

    SVC-Games

    Joined:
    May 21, 2013
    Posts:
    137
    Thanks to YOU for being such a great developer and for the excellent support :)

    EDIT: I've noticed that you have Axis 1 and 2 for the left stick and 4 and 5 for the right one. In my case it was the other way around, altohugh I might have screwed up when writing the response... I will check it later.
     
  3. CF-Games

    CF-Games

    Joined:
    Jun 2, 2013
    Posts:
    134
    Hello,

    We have a game where the player can rotate the screen and currently on the Xbox One controller it rotates without any input from the player. We realized that the axis mappings are different than that of the 360 controller. For 360, Axis 6 is the D-pad left/right. For X1, it's RT.

    We were wondering if there is a workaround for this for now, unless you have an update to cInput soon that fixes this.
     
  4. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I am still working out the best way to handle the differences between the Xbox 360 and Xbox One controllers.

    cInput should still work with the Xbox One controller how it is. It just won't give the correct mappings by default if you use the Keys.Xbox* mappings, as currently that's directly tailored for the Xbox 360. You should be able to remap the controls in game to work with the Xbox One controller, and use the Calibrate function to make sure cInput knows the default values of the axes.
     
  5. CF-Games

    CF-Games

    Joined:
    Jun 2, 2013
    Posts:
    134
    Our SetupKeys currently looks like this for gamepad movement:

    Code (CSharp):
    1. cInput.SetKey ("Gamepad Left", Keys.Xbox1LStickLeft, Keys.Xbox1DPadLeft);
    2. cInput.SetKey ("Gamepad Right", Keys.Xbox1LStickRight, Keys.Xbox1DPadRight);
    3. cInput.SetAxis ("Gamepad Horizontal Movement", "Gamepad Left", "Gamepad Right");
    When should the Calibrate function be called?
     
  6. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    As I said, the Keys.Xbox1DPadLeft/Right might not give the correct mappings for the Xbox One controller right now, so after you've opened up the UI and remapped the controls to use the correct inputs for the Xbox One controller would be a good time to call the Calibrate function, if necessary.

    Just in case there's some confusion on this point: The Keys.Xbox1* strings do not refer to Xbox One controllers. They refer to mappings for the Xbox 360 controller for the gamepad which Unity detects as "Joystick 1." Or in other words, the first connected gamepad in Input.GetJoystickNames.
     
  7. CF-Games

    CF-Games

    Joined:
    Jun 2, 2013
    Posts:
    134
    I've changed the keybindings in game before with the Xbox One controller, but it still didn't work. I'll try using the Calibrate function whenever a keybind is changed to see if it works. I'm also using my own custom UI rather than the one that came with cInput.
     
  8. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Make sure you wait until there are no keys/axes being pressed before calibrating. If an axis is being pressed down when the Calibrate function is called, it will mess with the calibration.
     
  9. SullyTheStrange

    SullyTheStrange

    Joined:
    May 17, 2013
    Posts:
    147
    Do you know how this error can be triggered? I've started getting this today while shuffling around some of our controls code, but for the life of me I can't figure out what I did that's causing it...

    Code (CSharp):
    1. ArgumentException: Input Axis Joy Axis 1 is not setup.
    2. To change the input settings use: Edit -> Project Settings -> Input
    3. cInput._GetCalibratedAxisInput (System.String description) (at Assets/cMonkeys/cInput/Plugins/cInput.cs:2110)
    4. cInput._CheckInputs () (at Assets/cMonkeys/cInput/Plugins/cInput.cs:2365)
    5. cInput.Update () (at Assets/cMonkeys/cInput/Plugins/cInput.cs:271)
    6.  
     
  10. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Try installing the cInput InputManager.asset file again. :)
     
  11. SullyTheStrange

    SullyTheStrange

    Joined:
    May 17, 2013
    Posts:
    147
    That did the trick, thanks! :D
     
  12. lucky3d1

    lucky3d1

    Joined:
    Jul 23, 2015
    Posts:
    4
    Hi there!

    Bought it yesterday and it's very cool!
    But eh am i the only one who can't get mouse movement to work in the build?
    In unity editor this code makes the object rotate but not in the build?

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class cube : MonoBehaviour
    5. {
    6.  
    7.     public float rot_axis;  
    8.    
    9.  
    10.     void Awake ()
    11.     {  
    12.         cInput.SetKey("orbit_left", Keys.MouseLeft, Keys.None);  
    13.         cInput.SetKey("orbit_right", Keys.MouseRight, Keys.None);
    14.         cInput.SetAxis("orbit_axis", "orbit_left", "orbit_right");
    15.         cInput.SetAxisSensitivity("orbit_axis", 1f);      
    16.        
    17.     }      
    18.    
    19.     void Update ()
    20.     {      
    21.         rot_axis = cInput.GetAxis("orbit_axis");
    22.         transform.localEulerAngles = new Vector3(0f, rot_axis*60f, 0f);
    23.  
    24.     }  
    25. }
     
  13. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    This code is working for me in both the editor and a Windows build. The behavior in both places (editor + build) seems to be the same.

    Any other clues that could narrow down this mystery?
     
  14. lucky3d1

    lucky3d1

    Joined:
    Jul 23, 2015
    Posts:
    4
    Thanks for your reply.
    My specs: Win7 64, Unity 5.2.2f1
    Build in x86_64

    But I've just created another test project and it works fine! But still doesn't work with the older test project wich contains the same files: cMonkey, the object script, and the scene file. Which scene/build parameter is broken though? I have to investigate :-/
     
  15. lucky3d1

    lucky3d1

    Joined:
    Jul 23, 2015
    Posts:
    4
    Is there a way to apply a second time Project Setting>cInput> Setup Input Manager? I reset the inputs by clicking the little gear button but now can't set the new cInputs manager... I get the error message "Input Axis Mouse Horizontal is not setup".
     
  16. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Make sure that the Input Manager isn't being displayed in the inspector when you "install" cInput. Otherwise what you see on screen (i.e., the old inputs) overwrites the file again.
     
  17. lucky3d1

    lucky3d1

    Joined:
    Jul 23, 2015
    Posts:
    4
    Ok looks like my project was corrupted... I couldn't even build an x86 build without errors so it seems the cInput plugin is not responsible for this ;-)
    I finally got it working by setting up a new project, copy all of the old project files except the ProjectSettings folder (but copying TagManager.asset afterward no to lose the tags and layers) and manually re-assign the project settings by hand in the editor.
    Thanks anyway, cInput is a great plugin :)
     
  18. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Thanks. I'm glad to hear you got it sorted out. :)
     
  19. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    fyi, you can win some perf in the GetKeyDown and GetKeyUp methods. They currently do 2 `_FindKeyByDescription` calls, which can be a bit expensive with a lot of input defined. Simply reuse the _index, just like you do in GetKey.
     
  20. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I just looked into this and I'm not seeing 2 calls to _FindKeyByDescription in GetKeyDown and GetKeyUp. They both use _FindKeyByHash once and reuse the _index.

    Perhaps you're using an old version of cInput?
     
    Last edited: Dec 10, 2015
  21. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Ah guess so.
     
  22. Mazak

    Mazak

    Joined:
    Mar 24, 2013
    Posts:
    226
    Hi,
    I'm using UFPS and cInput for a few scenes in my game and the problem is the mouse cursor is not working properly.

    Before I go into detail : Is there an update to the cInput for UFPS?

    Thank you
     
  23. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    cInput for UFPS hasn't been updated in a while -- because as far as we know it is working properly. But if you're experiencing problems with it then please let us know the details and we'll do our best to assist you.
     
  24. Mazak

    Mazak

    Joined:
    Mar 24, 2013
    Posts:
    226
    Simple issue:
    the mouse cursor never turns on.

    The simple fix is:
    Assets\UFPS\Base\Scripts\Gameplay\Player\Local\vp_FPInput.cs

    ~Line 396
    vp_Utility.LockCursor = false;

    Code (CSharp):
    1.  
    2. DontLock:
    3.  
    4.         // if user presses 'ENTER', toggle mouse cursor on / off
    5.         if (cInput.GetButtonUp("Accept 1")
    6.             || cInput.GetButtonUp("Accept 2")
    7.             || cInput.GetButtonUp("Menu"))
    8.         {
    9.             vp_Utility.LockCursor = false;
    10.         }
    11.  
    It is not the best fix, but it allows the mouse to become visible.
     
  25. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Hey Mazak,

    I will need to check this out again but i'm glad you found a fix for now.

    I can't remember having any issues with it and none were reported so far but i will test it out later today and report back.
     
  26. Mazak

    Mazak

    Joined:
    Mar 24, 2013
    Posts:
    226
    It may only be what I am doing, I added a chat box (and will add other things in the future)

    The mouse is invisible for Mouse Look Left and Right then when I want to chat I press Enter, pick the input box (or set the focus) but while this is active I want the mouse visible.

    Simple Test: Press Escape -> I don't see the mouse.
     
  27. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    anyone manage to get the right stick working for looking around in ufps?
     
  28. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    @radiantboy I think we got in touch with you via email and made sure that things were working for you. If that's not correct and you still need assistance please let us know.
    @Mazak did you and @Roidz99 get this issue taken care of?
     
  29. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Hey Mazak,

    I think this is UFPS related. cInput doesn't hide or unhide the mouse if i remember correct.
    It should be fairly easy to hide/unhide the mouse (but this might have been changed in recent unity versions).

    If you can't figure it out then please make a small test project (doesn't have to have actual gamecode in) where it's clear what should happen and i will take a look at it then.
     
  30. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Programmers, I need a hand.

    I have been using cInput Pro for about a year. I modified the demo and got the inputs and GUI working. Then I started using Ork Framework. At my request the developer added custom inputs and I easily set up Ork to reference the same inputs in my cInput initialization script, which is in my first scene. For a non-programmer, I thought this was fantastic. I love cInput. Then I started using Motion Controller 2.

    Motion Controller 2 has my player character working better than ever before, but, it requires an input controller object to drag into a slot. It won't accept anything I already have. Someone wrote an input script for Rewired and posted it on the Motion Controller site, but I can't quite get it modified for cInput. Motion Controller requires an input manager that reaches out to the inputs to get values with which to make its decisions, so I need a bridge script to substitute for the input manager script Motion Controller provides, so Motion Controller will reach, instead, to cInput for its values.

    Unity keeps giving me compiler errors, saying cInput is a type and not a namespace. All I want it to do is make a short functioning bridge script with contents like this:

    Code (CSharp):
    1.  public override float MovementX
    2.     {
    3.         get
    4.         {          
    5.             if (!_IsEnabled) { return 0f; }
    6.             return cInput.GetAxis("Horizontal");          
    7.         }
    8.     }
    9.  
    I guess I can't get the correct "using" statements or class inheritance or something like that.
    I am a novice programmer. Can one of you "Jedi"s help?
     
  31. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    From the sounds of it, you've got a "using cInput;" statement at the top of your script. If that is the case then the error message is exactly right. cInput is a type/class. It's not a namespace. A pastebin of your code, along with the full error (including line numbers) would greatly help in determining the cause of the error.
     
  32. Knil

    Knil

    Joined:
    Nov 13, 2013
    Posts:
    66
    Any plans making the Xbox one controller work with the Keys.Xbox1 SetKey method? After upgrading to Windows 10 I notice the dpad seems to constantly firing left.

    Also what is the current workaround?
     
  33. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi Knil,

    I think the solution may end up being to create something like Keys.XboxOne[whatever] properties so they don't interfere with the Xbox360 gamepad settings. And maybe rename the Keys.Xbox[whatever] properties to Keys.Xbox360[whatever] to help avoid confusion between them.

    Or maybe something a little less formal, leaving Xbox[whatever] for Xbox 360 and using Xbone[whatever] for Xbox One. But probably the more formal/correct one just for the sake of clarity.

    As for the DPad constantly firing left, this isn't something I'm experiencing on my end. Is this something you can reproduce in a new, mostly empty project?
     
  34. Arithan

    Arithan

    Joined:
    Feb 13, 2013
    Posts:
    3
    Hello,

    I'm also having this problem and it only happens on Windows 10. The reason I see is because the axis for Dpad left/right (360 controller) is the 6th axis. For the Xbox One controller the 6th axis is the right trigger instead of the Dpad. So when the right trigger isn't pressed on the Xbox One controller, it thinks Dpad left is being pressed if it uses the 360 controller mappings.
     
  35. Knil

    Knil

    Joined:
    Nov 13, 2013
    Posts:
    66
    The ideal situation would be that we could just call the generic Keys.Xbox and on cInputs end it would determine if it needs to use Xbox 360 or One mappings.

    I can also confirm Arithan's observation. From what I can tell it depends of what driver you have installed for the Xbox one controller there is supposedly two version.

    Hopefully we can get a solution for this situation soon, thanks!
     
  36. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    OK, so what you're saying is that when you use Keys.XboxDPadLeft in combination with the Xbox One controller, it always fires left because that maps it to Axis 6, which on the Xbox One controller is the right trigger, which has values from -1 (untouched) to 1 (fully pressed in). Now I understand the issue.

    I thought you meant that if you have the Xbox One controller's D-pad mapped correctly, it was always firing to the left.

    I agree that this would be ideal, but unfortunately it's just not how cInput works. cInput has no concept of individual input devices. It was designed to allow for easy key rebinding at runtime, where the player can just press the button they want to use. cInput doesn't know or care whether that button is an Xbox 360 controller, a steering wheel, a keyboard, or a flight stick (to name a few). It just scans for input and when a button is pushed it knows that's the input it should use for a specific action.

    cInput uses strings to assign inputs, just like the Unity Input Manager does. One problem I frequently have had with the Unity Input Manager is not knowing the exact string to type in, made even more frustrating by the fact that if you type in an invalid value, it blanks out the text box and you have to start again. We wanted to avoid a similar problem in cInput, so we created the Keys class to provide autocomplete on all valid inputs. Keys.G is just a string constant for "G" and Keys.Xbox1A just returns Joystick1Button0 (on non-OSX platforms).

    To make matters even more confusing, the Xbox 360 controller was notorious for having different button/axis mappings depending on the OS/platform. On OS/X, the A button on an Xbox 360 controller maps to button 16. But on all other OSes/platforms it maps to button 0. Almost every single axis/button on the Xbox 360 suffered from a similar situation, so I worked out all the cases to the best of my ability and added some Keys class specific properties to return the correct string value depending on the OS.

    But again, this is just a bunch of strings. Keys.Xbox1A isn't actually intelligently figuring out the A button on an Xbox controller. It's just a shortcut to autocomplete a string. And the string replacement happens basically at compile time (this isn't technically accurate). This means it can't change depending on whether or not an Xbox 360 controller or an Xbox One controller is being used.

    That said, it wouldn't be too difficult to write your code to use different templates depending on what kind of gamepad is being used. In your input setup script, you could do something like the following:

    Code (csharp):
    1. string[] jNames = Input.GetJoystickNames();
    2.  
    3. string jumpButton = Keys.Joystick1Button0; // default mapping
    4.  
    5. // handle Xbox 360/One controllers
    6. // NOTE: this assumes the Keys class has been updated with Xbox360 & XboxOne specific entries.
    7. switch (jNames[0]) {
    8.     case "Controller (Xbox One For Windows)": {
    9.         jumpButton = Keys.XboxOne1A;
    10.         // other inputs here
    11.         break;
    12.     }
    13.     case "Controller (XBOX 360 For Windows)": {
    14.         jumpButton = Keys.Xbox3601A;
    15.         // other inputs here
    16.         break;
    17.     }
    18. }
    19.  
    20. cInput.SetKey("Player1Jump", jumpButton);
    21. // other actions set up here
    Anyway, that's a long post/explanation to basically say that the "ideal" solution is non-trivial due to how cInput was designed. I've been trying to figure out a way to do it the ideal way, but unfortunately I'm not coming up with anything that wouldn't require fundamentally redesigning cInput almost from the ground up. :(

    That said, I'll at least add Xbox One specific entries to the Keys class so that it's no longer a guessing game as to which axes/buttons map to which Xbox One joysticks/triggers/buttons on which platform.
     
  37. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hmm... Come to think of it, I may have a solution for something close to the "ideal situation" after all.
     
  38. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Thanks for the suggestions Deozaan,

    I made progress over the weekend, and now only have errors like this:

    Overload Error.JPG Code causing error.JPG
    Code like the above works with string variables, but not KeyCode, (as above), or for Int.

    Any suggestions, greatly appreciated.
     
  39. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi @wood333,

    GetKeyDown() does not accept KeyCodes as passed in parameters. It accepts only strings, which are the name you assign to the input, or integers, which are a hash code of the string name you assign the input. Basically, GetKeyDown is expecting the name of the action associated with the inputs, such as "Jump" or "Shoot" or whatever you assigned when you set it up with cInput.SetKey().

    If you're not sure how to use GetKeyDown() or other cInput functions, you may find the included Reference Manual to be useful.
     
  40. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi folks,

    An update to cInput has been submitted to the Asset Store. If you bought cInput from the Asset Store then the update should be live within a few (business) days. If you bought cInput from our website, then the update is available immediately.

    cInput changelog:

    v2.8.8

    • Keys class attempts to smartly handle Xbox 360 and Xbox One gamepad differences.
     
  41. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120
    Just installed the new version, and I have a couple of issues to bring up:

    Using Keys.Xbox2DPadLeft, Keys.Xbox2DPadRight, Keys.Xbox2DPadUp, and Keys.Xbox2DPadDown in the code results in the error "IndexOutOfRangeException: Array index is out of range."

    Also, I'm still having problems using my Xbox One controller. The RB and LB buttons seem to be firing the RT and LT buttons, and pressing RT/LT doesn't work properly -- It seems like the button only fires when I'm lifting it up, rather than pushing it down.
     
  42. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Whoops! I know exactly why the array index error is happening. I'll get that fixed ASAP.

    As for the the bumpers and triggers, what OS are you using? And which version of Unity? Bumpers and Triggers are working perfectly for me in my development system (Windows 10).
     
  43. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120
    I'm using Windows 10 and Unity 5.3.2f1. Did you download specialized drivers for the controller at any point? I just plugged it in and figured Windows would do the rest. But yeah, I seem to be having at least some of the same issues that I did in the previous version.
     
  44. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I did not download any drivers for the Xbox One controller. Windows 10 took care of it automatically (possibly with Windows Update's option to "Give me updates for other Microsoft products when I update Windows" found in the "Advanced options" section?)

    I'm seeing the bumpers are mapped to buttons 4 & 5 while the LT and RT axes are mapped to axis 3 and 9 for LT and 6 and 10 for RT.

    What are you seeing for your mappings? I've made a build of a simple gamepad testing scene (using Unity 5.3.3f1) if you want/need it:

    Screenshot - 2_25_2016 , 2_20_56 AM.png
    https://dl.dropboxusercontent.com/u/37274/Unity/GamepadTester/GamepadTesterWin32v5.3.3.zip

    Also, if you use the Gamepad Tester, please tell me the string/name of the controller as detected by Unity, shown under "Current Gamepad:"
     
    Last edited: Feb 25, 2016
  45. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120
    Axis 1 and 2: Left thumbstick
    Axis 3: Normally -1, goes to 1 when LT is pressed.
    Axis 4 and 5: Right thumbstick
    Axis 6: Normally -1, goes to 1 when RT is pressed.
    Axis 7: Normally 0, D-Pad Right is 1, D-Pad Left is -1
    Axis 8: Normally 0, D-Pad Up is 1, D-Pad Down is -1
    Axis 9: Normally 0, goes to 1 when LT is pressed
    Axis 10: Normally 0, goes to 1 when RT is pressed

    Current Gamepad: Controller (Xbox One for Windows)

    I think you can ignore the issue with the bumpers that I mentioned, that seems to have been due to something else going on in my code. However, there's definitely something odd going on here. I just created a new scene and inserted an object with the following script:

    void Start () {
    cInput.SetKey("SelectLeft", Keys.Xbox1DPadLeft);
    }

    void Update () {
    if (cInput.GetButtonDown("SelectLeft")) {
    Debug.Log("PRESSED");
    }
    }

    If I press left on the D-Pad, nothing happens. However, if I press RT, the debug log appears.

    Just to note, I've updated to Unity 5.3.3f1

    ---

    On a slightly different note, I'm having another issue where if I plug in two Xbox 360 controllers at once, RT and LT do not work properly. These buttons only register if I press RT or LT on both controllers at the same time. Upon further inspection, it seems that Axis 9 and 10 are not registering properly. However, Axis 3 is working fine, so that's what I'm using as my current workaround to get RT and LT input from the controllers. I saw the note in your documentation about potential issues with Xbox 360 controllers, but the link no longer seems to contain the drivers that are mentioned, and my guess is that the average user isn't going to have these drivers either. Not that the driver would even necessarily fix this issue. It's also possible that I already have it installed :p

    Note that the issue does NOT occur if I have an Xbox 360 controller and Xbox One controller plugged in, it only happens with two Xbox 360 controllers. I haven't been able to test with two Xbox One controllers, as I only have one at the moment.
     
    Last edited: Feb 25, 2016
  46. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Thanks for this. This matches up with my results, too.
    Yes, this is something weird about Xbox 360 controllers and their drivers and Unity and... it's complicated. But I was under the impression that the issue was mostly fixed in the most recent versions of Unity. Anyway, I still see the driver listed here. But it seems to only be for Windows 7 or lower (as Windows 8+ have the driver built in?).

    But you're right. I never tested this after I upgraded to Windows 10. And now that I'm testing it I'm seeing my 360 gamepad's triggers only activate axis 3. Axes 9 and 10 are completely ignored/idle in my Gamepad Tester. But only if more than one 360 gamepad is plugged in. That's frustrating.
     
    Last edited: Feb 25, 2016
  47. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    In my tests this works as it should. My guess is that you have other settings saved to cInput from your other scenes, so when cInput initializes, it loads the previously saved/customized settings which overrides what you have in your script. Try adding a cInput.Clear() at the top of your Start() function to clear out any old data and let me know if the problem persists.
     
  48. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120
    I downloaded that, it doesn't seem to be a driver, but rather a little piece of helper software. Anyways, it didn't make a difference.
     
  49. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120

    I just tried that, and I'm getting the same results. More specifically: The second I press ANY button on the gamepad, the log appears. But just the first time. After that, the log appears only when I'm releasing RT.
     
  50. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    My bad. I thought the "helper software" was just a weird name for their driver.

    But anyway, I think it's a problem with Unity itself. I've noticed in my tests that if I only have one 360 gamepad plugged in when I start Unity, and then I plug in the other one(s), axes 9 and 10 work properly on all of them. But if I have multiple 360 gamepads plugged in when I start Unity, axes 9 and 10 are ignored/idle, even if I unplug the others.

    I can't fix this, but I'll definitely be submitting a bug report in the hopes that the folks at Unity will.

    But that still leaves the problem of e.g., Keys.Xbox1TriggerLeft mapping to Axis 9 when it should map to Axis 3. I'll see if I can hack in a workaround so the Keys class falls back to Axis 3 if there are multiple 360 gamepads connected. :(