Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.
Jibran Syed edited this page Sep 5, 2013 · 46 revisions

XboxCtrlrInput Documentation

Description

XboxCtrlrInput is a C# class for Unity3D that handles Xbox 360 controller input. It's used in the same way as Unity's Input class. The goals of XboxCtrlrInput are:

  1. To be able to make simple calls to Xbox controller input that works on Mac, Windows, and Linux (Ubuntu),
  2. And to be able to handle multiple Xbox controllers that works as you expect.

XboxCtrlrInput.cs itself is not a Unity script and thus does not need to be attached to any GameObject. Unity's Input class works in a similar way. Also like Input, you cannot inherit from XboxCtrlrInput because it's a sealed class. XboxCtrlrInput should work on older versions of Unity that support joystick input.

How to Use

Download the XboxCtrlrInput class file and then put it into your Unity project under the Assets/ folder. It can be anywhere in that folder.

Next, take the copy of the Unity Input Manager and replace the contents of your project's /ProjectSettings/InputManager.asset with the contents of the copy.

It's not a MonoBehavior, so no need to attach it like a script.

Note for Mac users: Be sure to install Tattie Bogle drivers.

Compatibility

  • The code in XboxCtrlrInput.cs should work in Unity 4.x and above.
  • It might work in previous versions as long as they support joystick input.
  • The example project requires Unity 4.2 or above (mostly due to the free text asset serialization).
  • This class was mostly designed for desktop OS games in mind (Mac/Windows/Linux). This probably won't work for console or mobile development.

Issues

Please refer to the Issues page for the latest issues.

Reference

Enumerations

XboxButton Used to identify different Xbox buttons.
XboxDPad Used to refer to the four D-Pad directions.
XboxAxis Used to identify all of the Xbox's analog inputs.

Static Variables

There are none, as of yet anyway.

Static Functions

GetButton() Returns true if the specified button is held down.
GetButtonDown() Returns true at the frame the specified button starts to press down (not held down).
GetButtonUp() Returns true at the frame the specified button is released.
GetDPad() Returns true if the specified D-Pad direction is pressed down.
GetAxis() Returns the analog number of the specified axis.
GetAxisRaw() Returns the analog number of the specified axis without Unity's smoothing filter.
Clone this wiki locally