daemon3000 / InputManager

Custom InputManager for Unity
Other
587 stars 88 forks source link

Multiple controllers and cross-platform issue #23

Closed oservieres closed 7 years ago

oservieres commented 8 years ago

This is a non-critical question. Mostly for curiosity.

This is my configuration :

image

My final purpose : make the game work with 4 controllers on Windows, Linux and Mac. Right now, the game works fine on Windows. It may also work correctly on other platforms with only one controller : the one defined in the Input Adapter. But I guess that the 3 other controllers are not gonna work.

At first I thought that I could use 4 input Adapters, each one assigned to a specific player, but it's a singleton.

So I'm quite stuck here.

daemon3000 commented 8 years ago

My advice is to not use the Input Adapter at all, it's obsolete. Initially it was meant to solve the following issues:

  1. Abstract away the fact that the XBox 360 controller has different buttons codes on each OS.
  2. Allow you use use the DPAD and triggers as buttons instead of axes.

For point 1 it's much better to have a menu in your game where each player can rebind their buttons. Configure the game for the Windows XBox 360 drivers and let users on Mac and Linux rebind the buttons and axes. The added bonus with this solution is that the player can use any gamepad they want not just the XBox 360 one.

For point 2 you now have the Analog Button axis type which can convert any stick/trigger to button input.

If you don't want to allow the players to rebind the buttons you can also do it this way:

oservieres commented 8 years ago

Thank you very much for all these information ! I had the same kind of idea than you : declaring all the configurations possible for each player/platform and assigning the appropriate ones to the input manager based on the current platform. But I didn't know that I could clone configuration. That may save a lot of time !

Thank you again.