Cross-platform Cross-Controller Gamepad Input Manager




What is the problem?

Although Unity exposes 20 buttons and 10 axes per input device (a controller or gamepad), the configuration of which axis or button relates to what actual button on the device is never clear without experimentation. To confuse this matter not all platforms use the same drivers, even with the same controller. For instance the XBOX controller has a unique configuration each for PC, Mac, and Linux.

What is the solution?

This plugin aims to abstract all of the mess and expose a neat, easy to understand and easy to use interface. The most popular controllers come with configurations already available (XBOX, PS, and Logitech/Generic) for PC, Mac, and Linux. With *NO* DLLs or external libraries, only C# scripts!

How can I get it?

You can get it on the Asset Store here [COMING SOON] for free while it is in open beta. If you found this useful and wish to show your support, donate some money. With enough support I can get hold of more controllers and more platforms (namely Android and iOS, and maybe OUYA) to include in this plugin.


Feature List

Simple, intuitive interface, that is device-independant

  • Input class-esque functions for all buttons and axes
//Gets whether the left bumper has been released
GamepadInput.GetButtonUp(Button.LeftBumper);
//Was the dpad's up-direction pressed
GamepadInput.GetButtonDown(Button.DPadUp);
//Is the X button held down (i.e. the lower action button)
GamepadInput.GetButton(XBOXButton.X);
GamepadInput.GetButton(Button.ActionDown); // This is the same command
//Is Controller 2's Circle button held down (i.e. the right action button)
GamepadInput.GetButton(PSButton.Circle, 2));
GamepadInput.GetButton(Button.ActionRight, 2));
//Is the left action button held down (X for XBOX, Square for PS, U for OUYA)
GamepadInput.GetButton(Button.ActionLeft));
//Is the start button was pressed
GamepadInput.GetButtonDown(Button.Start));
//Gets the left analog stick's horizontal value between -1 and 1
GamepadInput.GetAxis(Axis.LeftAnalogX);
//Gets the right trigger’s pressed value between 0 and 1
GamepadInput.GetAxis(Axis.RightTrigger);
//Gets the right analog's XY values between (-1,-1) and (1,1)
GamepadInput.GetXYAxis(XYAxis.RightAnalogX); 
//Gets the left analogs polar coordinates (angle, magnitude)
GamepadInput.GetPolarAxis(XYAxis.LeftAnalog));
//Gets the DPad as a Vector2
GamepadInput.GetXYAxis(XYAxis.DPad));
  • Negligable overhead
  • Support for up to 4 controllers

Automatic setup of axes and deadzones for calibrated controllers

  • Controllers effectively work the same, but all have differnt configurations in Unity's input settings. The GamePad Input Plugin abstracts that away to a homogonised input system
  • No need to mess around with axes for different controllers. Just plug in the gamepad and the Gamepad Input plugin does everything for you in the background!
  • No DLLs! All code is in Unity C# script and works on any platform
  • Come included with calibrations of all common controllers/drivers (XBOX for Win/Mac/Linux/Android[SOON]/iOS[SOON], PS3, OUYA[HOPEFULLY], MOGA[HOPEFULLY], Logitech/Generic)
  • Comes included with a helper classes to create a tool to configure custom controllers
    • Ability to add custom controllers to the game at build time (stored in a ScriptableObject)

Simple setup of Input Settings Axes via window

  • No more manually setting up 20, 40, 60, 80+ Axes in the Input Settings, one click and it's done for you!
  • If you have Input Settings Axes you want to keep, the plugin can append to your current Input Settings [requires PRO version of Unity]

Planned features

  • Recieve callbacks in code when a controller is connected or disconencted.
  • In-game configurable, simple to use left-hand/southpaw configuration, e.g. GamepadInput.EnableLeftHandMode(bool leftHanded, int controllerIndex)
  • In-game configurable, simple to use invert-Y configurations for analog sticks, e.g. GamepadInput.InvertY(XYAxis toInvert, int controllerIndex)
  • In-game configurable, simple to use deadzone configurations (i.e. change deadzone in game rather than in controller configurations)
  • More deadzone options (Axis-Deadzone, Radial-Deadzone, Scaled-Radial-Deadzone)
  • Generic controller configuration helper tools to allow in-game controller configuration and storage in PlayerPrefs
  • Support for other game controllers such as flight joysticks, driving wheels, <insert your suggestion here>
    • Android, iOS, and OUYA support 
    • XInput support (if requested enough)
    • I'm just one developer with a full time job creating this plugin in his spare time. I unfortunately don't have the funds right now to setup and test devices on Android, iOS and OUYA (I don't even have an OUYA, or even a Mac device :p), but by showing your support and donating this plugin I hope to be able to support many more platforms in the not too distant future!

9 comments:

  1. Fantastic, that`s exactly what i was looking for. Is it available already?

    ReplyDelete
  2. Hi Jonny, Lasse,

    Sorry for the delayed response. So there isn't really much more to share, other that I'm going to try get this out within the next two weeks or so. It underwent some serious battlefield dev testing when I used it in the recent Global Game Jam and there are some bugs I found that I have to fix up.

    The most serious thing that is holding me back is access to a PlayStation and Logitech generic controller. I have a friend who has these for me but with work and such I've kept putting it off.

    Lasse (and Jonny), if you just need it to work with XBOX controllers what I can do for now is fix up the aforementioned bugs and release it silently with just XBOX support (it's definietly going to be free for the time being). If anything it'll push me to get hold of the PS and logitech controllers and update it asap.

    Message back if this might work for you. And thank you both for your comments! It's about time I knuckle down and get this out!

    ReplyDelete
  3. This looks fantastic and exactly what I need! Is it out yet or still in development?

    ReplyDelete
  4. Hello Raxter,
    The Article give information about Cross-platform Cross-Controller Gamepad Input Manager.It's amazing to know about it.Thanks for Sharing the information about Cross Platform App Development.Xamarin Consultant

    ReplyDelete
  5. This is the most time-consuming step. You can start step 7 and 8 simultaneously with it. Creating and testing the BCP & DRP plan will ensure the business recovery in case of a disaster
    Pro HIPAA Officer Training

    ReplyDelete
  6. Freelance SEO Expert In India
    With Sanjay Baghela, your business Website is in safe hands. He and his team are the best SEO Expert in India the leading digital marketing field.
    Best SEO Expert In India

    ReplyDelete
  7. Freelance SEO Expert In India
    With Sanjay Baghela, your business Website is in safe hands. He and his team are the best SEO Expert in India the leading digital marketing field.
    Best SEO Expert In India

    ReplyDelete