- Home /
How do I listen for Input from joystick/buttons on a controller?
I bought a controller and the driver installed just fine. The device's properties screen shows that all buttons, joysticks and thumb pad send signals when I use them.
The ship in my Unity project moves with WASD, so the left thumb pad and joystick work, too, with Input.GetAxis("Horizontal") and "Vertical". I'd like to know how to watch for Input from the right joystick (and other buttons).
The purpose is to mimic the mouse, which I have read can be done with Xpadder by other means. My real goal is to learn how to listen for other input. I have already added Input keys for the keyboard 1..5 and I know that multiple Inputs can perform the same function.
Thanks in advance for your help. :)
Answer by Montraydavis · Oct 30, 2012 at 04:28 PM
Very simple !
function Update ( )
{
if ( Input.GetKeyDown ( KeyCode.X ) ){
//Do blaaa........
}
}
Take a look at the complete list of KeyCodes: http://docs.unity3d.com/Documentation/ScriptReference/KeyCode.html
You are very welcome ! I am glad that this works for you :) . Thanks for supporting Unity3D .! :D
will this also work for android games?(using game pads wth OTG cable)?
Ghost012.. did you get it working on Android?? I am stuck with that.. can you help?
chetanbansiwal ..... did the controller work well with android ??