daemon3000 / InputManager

Custom InputManager for Unity
Other
587 stars 88 forks source link

Xbox Controller buttons not registering, but analog axes are? #19

Closed Penthee closed 8 years ago

Penthee commented 8 years ago

Hey there, I've been using InputManager for quite a while now and have never had much of a problem with it, I recently updated the plugin in my Unity project and have attempted to set up controller support for our game.

It's mostly going okay, I've got the analog sticks and triggers working fine, but none of the buttons or bumpers are working. No errors, just the Axes do not return a value. I'm not really sure what I could be doing wrong, as I suspect that it's me rather than an issue with the code. I've tried numerous input configurations (almost everything I could think of), all based off the default files.

Any ideas? I can give you a copy of the project if you wish.

Also, while I'm here - I've got a small issue with the InputAdapter where it breaks on initialisation if the gameobject is enabled straight away - a workaround is to enable it a second after the scene has loaded but this seems a bit hacky. It throws the following: NullReferenceException: Object reference not set to an instance of an object TeamUtility.IO.InputMgr.SetInputConfiguration (System.String name, PlayerID playerID) (at Assets/Scripts/Utils/InputManager/Source/Runtime/InputManager.cs:639) TeamUtility.IO.InputAdapter.SetInputDevice (InputDevice inpuDevice) (at Assets/Scripts/Utils/InputManager/Addons/InputAdapter/Runtime/InputAdapter.cs:597) TeamUtility.IO.InputAdapter.Awake () (at Assets/Scripts/Utils/InputManager/Addons/InputAdapter/Runtime/InputAdapter.cs:445)

daemon3000 commented 8 years ago

For the first issue I need you to create a new project and try to replicate the issue there. If you can replicate it there send the project to me so I can debug it.

For the second issue make sure the InputManager script is first in the script execution order(Edit/Project Settings/Script Execution Order).

Penthee commented 8 years ago

Okay so I've created a new project and have set up a super basic test of receiving different kinds of input from the controller. The issue still remains so here is the test project I just made. Let me know if you want to have a look at the full project.

As for the second issue, Script Execution Order fixed it - thanks, didn't think of that! :)

Appreciate the prompt reply!

daemon3000 commented 8 years ago

Jump, Cancel, LeftBumper and RightBumper are buttons but you call InputManager.GetAxis which will always return zero. Use InputManager.GetButton instead.

Penthee commented 8 years ago

I can't believe I didn't see that. How very... embarrassing. :')

Thanks for your time.