# Overview

Rewired is an advanced input system for Unity with many powerful features.

## Features:

- Works in Unity free and Pro.
- Player-centric input system.
- Full hot-plugging support on Windows, OSX, Linux, Windows 8 Store, Windows 10 Universal, Ouya, WebGL, Xbox One, PS4, and Switch. (Other platforms depend on Unity's input system's support for hot-plugging on that platform.)
- Extended native input support on several platforms.
- Optional XInput support for Windows (mandatory for Windows 8 Store).
- Fallback on Unity input for all other platforms. Most features still work.
- Intelligent auto assignment and re-assignment of controllers to players on connect/disconnect with configurable options to tune the assignment to your needs.
- Connect, pre-disconnect, and disconnect events.
- Get input in Update, Fixed Update, and OnGUI -- you choose which loops update runs in, one or multiple as needed.
- Customizable and saveable controller maps -- export mappings to XML or JSON and save how you choose (example included using PlayerPrefs, but save however you like.)
- Included Control Mapper system using Unity GUI allows your players to rebind controls at runtime.
- Unlimited mapping layouts per controller.
- Controller Templates (see Controllers section).
- Included on-screen touch controls for mobile platforms. (Unity 5.0+)
- Editor GUI for creating Actions, Input Behaviors, Joystick/Keyboard/Mouse maps, categories, etc.
- Editor GUI for creating and editing Joystick Hardware Maps (for adding new fully-supported joysticks).
- Editor GUI for creating and editing Controller Templates (for adding new templates or adding new joysticks to a template).
- Extremely versatile -- can be used for simple 1-player games all the way to highly complex multi-player games with complex mapping requirements. Gives the developer a high level of control and doesn't try to force you into a specific one-size-fits-all mold.

#### Controllers:

- Functional support for most USB and Bluetooth controllers [1] (see below).
- Extended support for many game controllers of all types on numerous platforms. You can create additional controller definitions to support more, or if you'd like you can mail me your controller and I'll add the definitions and mail it back! :)
- Supported controllers are recognized on each platform and are fully mapable by element name and have standardized axis directions.
- For any controller not included, you can map an Unknown controller which includes all possible buttons/axes on the platform (Windows 128 buttons & 32 axes, etc.) Regardless of whether you define a map for this, users will always be able to manually map every element on the controller. This means support for the vast majority of USB and Bluetooth controllers. [1]
- Controller template system so you can either choose to create default maps for every controller you wish to explicitly support, or save time and just map the template. All controllers that use that template will be mapped automatically. Rewired comes with controller templates for gamepads, flight controllers, racing wheels, and 6-dof controllers. User can always map any remaining controller elements even if they're not defined on the template.
- Named buttons and controller elements for supported controllers (for help messages and config screens).
- Vibration (Windows, Windows 8 Store, Windows 10 Universal, OSX, Linux, XBox One, PS4, Switch currently).
- Advanced controller features such as vibration, touchpad, light, and gyro on the Dual Shock 4.
- Custom Controllers - Any source can be used to drive the controller's element values. Custom Controllers can be used for on-screeen touch controllers and more.

#### Mapping:

- Powerful controller mapping system that allows you to create highly complex input schemes for any style of game.
- Unlimited maps per controller, per Player.
- Maps stack so you can have as many maps for each controller as you need. For example: If you have multiple game modes such as Infantry, Tank, Airplane, you can have shared controls on one map, and mode-specific controls each on its own map. You can have even more maps as needed: A Menu map for when you're in the menus, a system map for controls like Save/Load and Quit, multiple maps for different players on the keyboard, etc.
- Enable / disable maps as needed, for example, when changing game modes.
- A shared controller (the keyboard for example) can be mapped by any number of players with any number of maps.
- All maps are owned by the player, so changes you make to one player's maps don't affect the others even if it's on the same controller.
- Map axes to buttons and buttons to axes if you choose.
- Split axes - allows you to map one pole of an axis to an action and the other pole to another action if you want.
- Axis Contribution - you can choose how your button or axis affects the final Action's value. A button can generate positive or negative values on an Action's final axis value.
- Save maps to XML or JSON.

#### Input:

- Standard Unity lingo: GetButton, GetButtonDown, GetAxis.
- Poll for input as per Unity standard practice or use event-based input to get input without polling.
- Input is handled through the Player class: player.GetAxis("actionName").
- Get input directly from elements by index if necessary.
- Get Action input by action name or action id.
- Positive and negative buttons.
- Double-press/click support with customizable timing.
- GetButtonDown buffer -- allows you to make GetButtonDown respond for longer than a single frame to help with timing issues when user is pressing the button rapidly.
- Keyboard modifier support - Map keyboard controls with up to 3 modifiers - Control, Alt, Shift, and Command (mac).
- Axis calibration (min, max, zero, deadzone, sensitivity)

#### Players:

- Unlimited number of players.
- Supports multiple controllers per player.
- Convenient System player for handling system actions - Save, Load, etc.
- Define starting maps for joystick, keyboard, and mouse per-player.

#### Actions:

- Define actions in the editor.
- Action categories for organizational convenience.
- Set user-assignable flag on an Action or Action Category to allow or prevent certain actions from showing up in lists (useful for mapping screens.)

#### Input Behaviors:

- Input Behaviors allow you to set options for digital axis simulation (sensitivity, gravity, etc.), how to handle mouse axes, a GetButtonDown buffer, button double press speed, button dead zone, and more.
- Each Action is assigned an Input Behavior, so if you have many actions that need to behave the same way, you don't have to duplicate the information, just set them to use the same Input Behavior.
- Per-player, and run-time modifiable.
- Save to XML or JSON.

#### Map categories:

- Categorize your maps by any criteria you choose. For example: System, Menu, Gameplay Shared, Infantry, Vehicle, Airplane.
- Set user-assignable flag on a category to allow or prevent user-assignment of certain controls (system controls should be protected from change, for example).
- Category selective conflict checking - choose to conflict check some categories with other categories, but not necessarily in both directions. (Useful for complex stacked map setups).

#### Map Layouts:

- Multiple layouts per category. Allows you to have optional controller layouts.

#### Other:

- Input Manager is self-contained so you can actually have separate input managers for different levels if you choose with entirely different mappings, etc. (Not necessary but interesting!)
- Functions for mapping conflict checking
- Identify joysticks by button press in Unity Fallback mode.
- Included example of mapping screen using Unity GUI (will update when new GUI system comes out) including saving and loading of maps per-player.
- Documentation

#### Performance:

- Rewired is fast, written in C#, and tuned for performace.
- ZERO bytes of memory allocated per-frame during gameplay situations means no garbage collection overhead.* (Some allocations required during remapping).
  * Fallback platforms have periodic very small allocations as it polls Input.GetJoystickNames() every second or two to detect joystick changes.

#### Limitations:

- Hot-plugging in Windows Webplayer is not possible because the Windows Unity webplayer cannot access outside libraries. However, the rest of the features work just fine in Webplayer.
- Rewired is not for those who want to make games with zero coding knowledge. Coding is required.

#### Requirements:

- Unity 4.3 or later, Free or Pro.
- Unity 4.6 or later required for Control Mapper.
- Unity 5.0 or later required for WebGL native input and Touch Controls.
- OSX 10.5 or later is required for the OSX Unity editor and OSX Standalone builds.

#### Tested Platforms:

Rewired has been tested on the following platforms. Others may work but have not been tested. The following table shows which platforms / scripting backends include native input libraries for enhanced reliability and feature support. All non-native platforms will run on top of Unity's input system and still provide most features.

For platforms using native libraries, the devices supported natively are listed below. If a device type is not listed such as "mouse", it is supported through the use of Unity's input system at the base but will still work as expected.

Platform | .NET/Mono Scripting Backend | IL2CPP Scripting Backend
Windows Standalone 32-bit/64-bit | Native (keyboard, mouse, controllers) | Unity [4]
Windows 8 Store | Native (controllers) | --
Windows 8.1 Universal | Native (controllers) | --
Windows 10 Universal 32-bit/64-bit | Native (controllers) | Native (controllers)
Windows Webplayer | Unity | --
OSX Standalone 32-bit/64-bit/Universal | Native (controllers) | Unity [4]
OSX Webplayer | Unity | --
Linux [3] | Native (controllers) | Unity [4]
WebGL | -- | Native (controllers)
Android | Unity | Unity
iOS | Unity | Unity
Sony PSM (Sony PlayStation Vita) | Unity | --
Sony PlayStation 4 | Semi Native [2] (controllers) | Semi Native [2] (controllers)
Microsoft XBox One | Semi Native [2] (controllers) | Semi Native [2] (controllers)
Nintendo Switch | -- | Native (keyboard, controllers)
Ouya | Native (controllers) | Native (controllers)
Apple TV (tvOS) | Unity | Unity
Amazon Fire TV | Unity | Unity
Google Nexus Player | Unity | Unity
Razer Forge TV | Unity | Unity
GameStick | Unity | Unity

1 Controller must be compatible with underlying system. On Windows the controller must be compatible with Raw Input, Direct Input, or XInput. On OSX, it must be compatible with I/O Kit. On Linux, it must be compatible with UDev. Support for exotic controller types not guaranteed.

2 These platforms make use of Unity's special platform-specific input classes which allow for much greater control over input than with just UnityEngine.Input and are functionally equivalent to native input libraries.

3 Linux native support has been tested under Ubuntu 12.04 amd64, Ubuntu 14.04 x86/amd64, Ubuntu 15.04 amd64, Ubuntu 17.04 amd64, Mint 17.2 amd64, and SteamOS. Compatibility with other distros is not guranteed or implied.

4 Please see this for more information about the IL2CPP scripting backend on desktop Standalone builds.

Documentation Release Notes