Getting an axis programmatically


I know that I can get at a joystick button like this:

bool isDown = Input.GetKeyDown( “joystick 1 button 0” );

This works even if I don’t set up any inputs in the input manager, and is equivalent to getting a particular keyboard key.

but is there any equivalent way for a joystick axis? Or do I need to set up each axis that I want to use? which would be 8 per controller * 8 players in my case (equalling way too much fiddly work). Thats a huge amount to set up by hand, I would rather not have to write a script to generate the asset file. Anybody know if there is a way to access a particular axis, on a particular joystick simply by a name/designation?

I should redirect you to using xinput. If you are working on windows, using multiple controllers are super simple.

Download the Unity project from this Github Repo. It has a few scripts that answer your question.