- Home /
Using Xbox gamepad triggers as keys instead of axis?
The triggers from the Xbox 360 gamepad are accessed by axis in Unity. I was wondering if there is a way to recognize them instead as keys.
Thanks in advance
0tacun
Answer by gfoot · Apr 28, 2014 at 10:38 PM
Try using axis 9 and axis 10 to read the triggers. This has worked for me in the past, but I think I heard that it doesn't work properly when you have multiple Xbox360 pads connected to the same PC. This is usually blamed on poor quality DirectInput drivers provided by Microsoft.
Microsoft also provide XInput drivers for the pad, which apparently work a lot better, but Unity's input system doesn't use XInput so it can't benefit from those drivers.
Apparently you can still use XInput yourself to read the pad, for example using this library:
https://github.com/speps/XInputDotNet
But I haven't tried it.
Thank you for your reply.
But what should I do if the user don't own a xbox gamepad and on his gamepad the L2/R2 buttons are read as keys? He can't assign those to the axis.