Tutorial: Support gamepads in Unity

Unity is a game development framework that lets you create 2-D and 3-D content, and then build and publish that content for various platforms and devices (including BlackBerry 10 devices). Unity provides support for many gaming features, including gamepad support through the Input Manager (among other methods). You can also use the Input APIs that Unity provides, but in many cases, the Input Manager gives you more flexibility in how you want to handle user input in your game.

In this tutorial, you'll learn how to create the UnityGamepad sample app that's included in the Core Native Community Samples repository in GitHub. This sample app contains a simple UI that depicts the arrangement of buttons and joysticks on a typical gamepad. The app detects when a gamepad is connected to the device, and when input from that gamepad is detected, the corresponding UI elements light up.

Screen shot showing the UI of the UnityGamepad sample app.

You will learn to:

  • Create a simple scene to represent the UI in Unity
  • Create primitive objects to represent the buttons and joysticks of a typical gamepad
  • Apply transformations to position the UI elements
  • Use mesh renderer components to apply materials
  • Create a C# script to detect a connected gamepad and handle input from it
  • Define inputs using the Input Manager

Last modified: 2015-03-31

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus