Integration with Other Packages
Packages:
Unity UI
Rewired can be used as the input source for Unity's UI system introduced in Unity 4.6. In order to use Rewired to control Unity's UI, you must replace the StandaloneInputModule component on the UI EventSystem object with the RewiredStandaloneInputModule. This will allow the UnityUI system to receive input from Rewired. You must also create the appropriate actions in Rewired to match the Actions listed in the RewiredStandaloneInputModule and assign these Actions to one or more Controller Maps then assign those to one or more Players.
When you install or upgrade Rewired, it will automatically install the RewiredStandaloneInputModule.cs file in the Rewired/Integration/UnityUI folder provided you are running Unity 4.6 or greater.
In order to use it:
- Create your Unity UI as per normal practice.
- Select the EventSystem object in the scene.
- Disable the StandaloneInputModule component on the EventSystem object.
- Add the RewiredStandaloneInputModule component to the EventSystem object.
- Customize the settings on the RewiredStandaloneInputModule if desired.
- Open the Rewired Editor and create an Action for each of the controls listed in the RewiredStandaloneInputModule. By default, these are "Horizontal", "Vertical", "Submit", and "Cancel." The names must match exactly. If you'd like to change the names of these Actions, you may do so, but they must match between the Rewired Editor and the RewiredStandaloneInputModule.
- Create one or more Joystick, Keyboard, or CustomController maps with the Actions you created above assigned to elements.
- Assign the controller maps map(s) to one or more Player.
- Adjust the settings in the RewiredStandaloneInputModule to change which Player(s) input is drawn from and other options.
Now your Unity UI should be controlled by Rewired instead of Unity's input system.
An alternate way of adding a Rewired Standalone Input Module is to create a Rewired Event System through the menu: Game Object -> Create Other -> Rewired -> UI -> Rewired Event System
Note that the RewiredStandaloneInputModule is just a slightly modified version of Unity's open-source StandaloneInputModule. The only changes to it are to make it work with Rewired as the input source. No attempt has been made to enhance this UI system to support multiple simultaneous selection controls (for example, a multi-player character selection screen). That is beyond the scope of this convenience component.
Note: Do not assign UI Submit or Cancel Actions to Mouse Left Button or Mouse Right Button or you will receive double-clicks evey time the mouse button is pressed over a button. The mouse button click on a UI element is based on mouse cursor position and does not use the Action system.
UFPS
Rewired can be used to provide input for UFPS, a popular first person shooter kit by Vision Punk. Rewired comes pre-packaged with an integration kit that was designed to work with UFPS 1.4.9.
To install the UFPS Integration Pack, do the following:
- Ensure that you are running Unity 4.5 or greater.
- Install Rewired and UFPS first. If UFPS is not installed, you will get errors when the integration pack is installed.
- Run the following menu item in the Unity editor:
Window -> Rewired -> Integration -> UFPS -> Install Integration Pack - Follow the on-screen prompts.
- When installation is complete, you will need to create a Rewired UFPS Input Manager in your scene before Rewired will be able to handle input. You can do this from the menu:
Window -> Rewired -> Integration -> UFPS -> Create UFPS Rewired Input Manager - The Rewired UFPS Input Manager contains default settings for all of UFPS's controls for the keyboard, mouse, and dual analog gamepads. If you want to customize the controls, simply click the "Rewired UFPS Input Manager" then edit the settings in the Rewired Editor.
To Uninstall:
- Delete the Rewired/Integration/UFPS folder
- Delete the Rewired UFPS Input Manager from the scene
Notes:
- UFPS's built-in input manager will no longer have any effect as long as the Rewired UFPS Input Manager exists in the scene. Additionally, some UFPS functions such as those designed to let you remap keys will no longer have any effect. You should manage key remapping using Rewired instead.
- The Rewired UFPS integration pack makes no changes to the UFPS source code. You are therefore free to update UFPS as you see fit without losing the integration with Rewired.
- If you install UFPS after installing Rewired, UFPS will overwrite the /ProjectSettings/InputManager.asset in your project. This will overwrite Unity input manager entries that Rewired needs to be able to get mouse input or to get joystick input on platforms that fall back on Unity input as the input source. If this happens, simply reinstall Rewired's Input Manager settings by running the installer from the menu Window -> Rewired -> Setup -> Run Installer and allow it to overwrite the InputManager.asset file.
