Hi
The title pretty much says it all. I want my players to be able to assign custom gamepad buttons for the controls. So imagine you click on “jump” and a message says “press the key for jump”, after which you press that key, the game remembers which one it was and you can use the new setting from then on.
To do that for a keyboard is easy, since I only have to call
public void OnGUI ()
{
if (Event.current.type == EventType.KeyDown) {
KeyCode code = Event.current.keyCode;
[...]
to find out what was pressed and it is very easy to work with that KeyCode.
For gamepads however there does not seem to be such an event. The only option I have found so far is to poll
if (Input.GetKeyDown ("joystick 1 button 0"))
for each button on each gamepad during each update(), which seems very bloated and certainly not right.
Does anyone know an easier way to catch any button that has been pressed?