At the Unite Nordic and Nordic Gaming Conference, we showcased how a BlackBerry 10 smartphone can so easily turn into a console gaming system with your favorite gamepad and a micro HDMI cable hooked up to a TV. Unity developers loved it and wondered how their games can leverage that. This blog posts shows you how easy it is to add gamepad support for BlackBerry 10.


The BlackBerry 10 Native SDK provides a native Gamepad API that currently supports the following gamepads

  1. Moga Pro Game controller
  2. SteelSeries Free controller
  3. Gametel controller
  4. Nintendo Wii Remote

Support for more gamepads are being added as we speak and native games utilizing this API does not have to worry about changing their code to support them.

The Unity SDK uses the Gamepad API to provide out-of-the-box support to the gamepads listed above through its Input system API. The API allows accessing the connected gamepad’s names, axis values and currently pressed buttons.

Lets see how to setup and leverage BlackBerry 10’s gamepad support in your Unity games.

Step 1: Configure gamepad’s analog joysticks

The first thing you need to do is setup the Input settings from the Project Settings as shown below:


If your game would benefit from analog joysticks, the setup involves specifying names to axes of analog joysticks on your gamepad. For example, a top down shooter game with one analog joystick controlling the player movement and the other controlling direction of fire would require 4 axes to be setup:

Axis 1 – corresponds to the horizontal movements of the right joystick (X axis)

Axis 2 – corresponds to the vertical movements of the right joystick (Y axis)

Axis 3 – corresponds to the horizontal movements of the left joystick (3rd axis)

Axis 4 – corresponsds to the vertical movements of the left joystick (4th axis)

The Input settings below shows a sample configuration:


The cool part is that 2 joysticks can be paired to a BlackBerry 10 smartphone at once. If your game supports on-device multi-player feature, you could simply start by adding another 4 axes with Joy Num pointing to Joystick 2.

Step 2: Configure Gamepad Buttons

Actually, there is no configuration required here. The gamepad keys are already pre-mapped to KeyCode that your game could start listening to and react on. For example: the KeyCode mapping of a Moga Pro and SteelSeries Free Gamepad that are currently supported for BlackBerry 10 are shown below:



As you can see from the above mappings, other gamepads with conventional layouts will report the same KeyCode for a button in same/similar position. For example, pressing up on a DPad up should report JoystickButton8 on any gamepad with a DPad.

Step 3: Reading the Gamepad Input

The following C# script shows how straightforward it is to integrate the gamepad support:

First, we declare an array of floats to listen to 4 axes input values from the analog joysticks and a string to identify currently pressed button. To obtain an axis value, I simply call the Input.GetAxisRaw(<Axis name>) and then use it to transform my object. The currently pressed button can be obtained by simply checking for the KeyCode corresponding to the above gamepad mapping.

Note: Many gamepads still do not have support for analog joysticks (for example: Wii Remote, Gametel etc.) and it is worthwhile adding core game controls via DPad if relevant.


Step 4: Switching between touch control and gamepad

Almost all games have touch controls but with a gamepad in reach gamers would love to player your game with it instead. Those with an appetite for long and non-stop hours of gameplay would very much appreciate an on-the-fly switch from touch controls to gamepad. Assuming your Bluetooth is turned on and the gamepad is in the pairing mode, you should be able to detect a gamepad by simply checking Input.GetJoystickNames() in your script’s update() for “BlackBerry Gamepad”. When paired, you could disable the touch gamepad altogether and use real gamepad controls to put your game in a “console mode”.

Note: “BlackBerry Gamepad” is the currently returned identifier for all BlackBerry supported gamepads in BlackBerry 10 Add-on Open Beta. I recommend checking again for any changes in the returned gamepad identifier after Full release of the Unity BlackBerry 10 Add-on.

There you have it folks. This is all it takes to add gamepad support to your Unity games. Awesome thing is we are committed to adding support all the cool gamepads out there and you may never have to change a line of code to support them!

For any questions, comments, concerns or kudos feel free to reach out to me directly at or connect directly on Twitter at @rmadhavan7.



Adding Gamepad Support to Unity Games on BlackBerry 10