Special Platform Support

Platforms:

 


Windows 8 Store

To build for the Windows 8 Store, you must install Windows 8 Store support. In order to build for this platform, you must be using the Windows Unity editor.

Install Windows App Store platform support through the menu:
Window -> Rewired -> Setup -> Install Platform Support -> Windows 8 Store

NOTE:
Rewired does not support Windows 8 Store in Unity 5.0.0 due to a new Unity bug. See this page for details. The bug was fixed in 5.0.1, so upgrade to Unity 5.0.1+ if you need Windows 8 Store Support.

IMPORTANT NOTE FOR UNITY 5 USERS:

Unity 5 requires that a Placeholder path be set in the Plugins/Metro/Rewired_Core.dll inpspector or you will get compilation errors when you try to compile. You must set this path to the current location of the main Rewired_Core.dll in your project. If you move the Rewired folder to another directory, this path will have to be changed manually because Unity stores a path here instead of a GUID.

Here are the steps:

  1. Select Plugins/Metro/Rewired_Core.dll in the project view.
  2. In the inspector, click the Placeholder field and navigate to Assets/Rewired/Internal/Libraries/Runtime/Rewired_Core.dll.
  3. Click Apply.

This is not automated because users tend to move Rewired around into various folders in the project. Because Unity chose to store a path here instead of a GUID, the link will break each time the Rewired folder is moved.

Windows 8.1 Universal target build issue:

The Unity Editor currently has a bug that does not allow designating a DLL to be included only for the Windows 8.1 Universal build target. Because of this bug, it is impossible for Rewired to "just work" on Windows 8.1 Universal builds. In order to build to Windows 8.1 Universal, you will have to manually set the WSA target SDK in the inspector to "Any SDK" on both of the following DLLs:

  1. Plugins/Metro/Rewired_Core.dll
  2. Plugins/Metro/Rewired_Windows8Store.dll

If you do not the WSA SDK target to "Any SDK", Windows 8.1 Universal builds will always fail.

If you are also going to build to Windows 10 Universal (UWP), you must first set the above DLLs back to SDK81 or disable WSA on the DLLs entirely. If you do not, these Windows 8 DLLs will be included when building to Windows 10 Universal (UWP) and the build will fail.

This bug has been reported to Unity. There is no automatic workaround at the present time.

Controller Support

Only the XBox 360 Controller and other XInput-compatible controllers will work on the Windows 8 Store platform.

 


Windows 10 Universal

Windows 10 Universal support requires Unity 5.2+

To build for the Windows 10 Universal, you must install Windows 10 Universal support. In order to build for this platform, you must be using the Windows Unity editor.

Install Windows 10 Universal platform support through the menu:
Window -> Rewired -> Setup -> Install Platform Support -> Windows 10 Universal

IMPORTANT NOTE:

Unity 5 requires that a Placeholder path be set in the Plugins/UWP/Rewired_Core.dll inpspector or you will get compilation errors when you try to compile. You must set this path to the current location of the main Rewired_Core.dll in your project. If you move the Rewired folder to another directory, this path will have to be changed manually because Unity stores a path here instead of a GUID.

Here are the steps:

  1. Select Plugins/UWP/Rewired_Core.dll in the project view.
  2. In the inspector, click the Placeholder field and navigate to Assets/Rewired/Internal/Libraries/Runtime/Rewired_Core.dll.
  3. Click Apply.

This is not automated because users tend to move Rewired around into various folders in the project. Because Unity chose to store a path here instead of a GUID, the link will break each time the Rewired folder is moved.

Enabling HID Joystick Support

In order to enable support for HID joysticks, after building the project in Unity, open the new Windows 10 Universal project in Visual Studio and edit the Package.appxmanifest file with the XML text editor and add the following lines:

<Capabilities>
<DeviceCapability Name="humaninterfacedevice">
<Device Id="any">
<Function Type="usage:0001 0004" />
<Function Type="usage:0001 0005" />
</Device>
</DeviceCapability>
</Capabilities>

The <Capabilities> tag and its contents must be placed between the <Package> and </Package> tags. This gives the app permission to read HID joysticks and gamepads. If you do not add this or do not add it correctly, HID joysticks will not work. However, the XBox 360 Controller and other XInput-compatible controllers will still function.

WARNING: There is a known issue with Unity in IL2CPP builds when enabling support for HID joysticks. See this for more information.

Error On DLL Import

Unity reports this error every time the Rewired_Core.dll for Windows 10 Universal .NET is imported or reimported into the project:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Ignore this error. There is no reason for this error and no way to silence it. It has no effect on the functionality of the library.


OUYA

To build for the OUYA platform you must first install the OUYA Everwhere SDK Unity plugin. This can be obtained from the OUYA Developer site here.

For help installing and configuring OUYA support for Unity in general, see the docs:
OUYA plugin documentation

Building to Ouya

To build for the Ouya platform, you must do the following:

  1. Follow the OUYA plugin documentation to set up the Unity environment for Ouya support.
  2. Switch the Unity editor build target to Android.
  3. Ensure that "Build to Ouya" is checked in the Rewired Global Options panel which can be found at:
    Window -> Rewired -> Global Options
  4. Place OuyaGameObject prefab from the OUYA SDK in your scene as mentioned in the OUYA plugin documentation.
  5. Build through the standard Unity build panel.

For questions about supported controllers on Ouya, see here.

 


XBox One

Rewired includes special support for XBox One for better controller support and more accurate hot-plugging behavior. Rewired supports gamepad vibration on XBox One, however you must first install the prerequisite Xbox One native library provided by Unity.

If you receive an error when switching to the Xbox One build target in Unity, make sure the Xbox One platform is checked on the Rewired_Core.dll import options.

Dependencies

Xbox One support requires that you install the following native library provided by Unity be installed into Plugins/XboxOne in your project:

  • Gamepad.dll

To get the library files, go to:
Unity Xbox Forums > Build Downloads (Sticky Topic) > Under "Latest Builds" is "Unity's Xbox One Native Plugins"

Without this dependiency installed correctly, XBox One builds will not function. You may only see black screen when launching the build on the Xbox One if the library is not installed.

Crashes on Start

This is always due to improper set up of the dependencies noted above. If Gamepad.dll is not found, not in the proper location, or does not have the proper inspector settings to enable it to be included with the XBox One build, all p/invoke calls to Gamepad.dll will fail, which crashes the XBox One rather than throwing an exception which can be caught and handled as happens on all other platforms. If the version of Gamepad.dll you are using does not have the exact method signature matches which Rewired expects, it will also crash. If you upgrade Unity versions but do not update the Gamepad.dll also, it may also crash if the gamepad.dll has been built to a different version of the Xbox One SDK.

Accessing XBox One Controller Features

Special controller features of the XBox One gamepad such as vibration can be accessed via the XboxOneGamepadExtension class available in the Joystick class as seen in the example below:

using Rewired;
using Rewired.Platforms.XboxOne;

class XBoxOneTest {
    void MyMethod() {

        // Set vibration in all controllers in player
        foreach(Joystick joystick in player.controllers.Joysticks) {

#if UNITY_XBOXONE && !UNITY_EDITOR
            // Get the ControllerExtension for Xbox One and set left gamepad motor to full value
            // Note: Vibration can also be set in a more generic way through Joystick.SetVibration by using the motor index.
            XboxOneGamepadExtension extension = joystick.GetExtension<XboxOneGamepadExtension>();
            if(extension != null) {
                // Set vibration using the XboxOneGamepadMotorType enum
                extension.SetVibration(XboxOneGamepadMotorType.LeftMotor, 1.0f);
            } else {  // extension was not found or not the right type
                // Set first motor to full value
                joystick.SetVibration(0, 1.0f);
            }
#else
            // Set first motor to full value
            joystick.SetVibration(0, 1.0f);
#endif
} } }