Version: 2018.2
Input XR de Unity
Entrada para controladores OpenVR

Input for Windows Mixed Reality

Windows Mixed Reality motion controllers allow users to interact in Mixed Reality applications, allowing precise, low latency tracking of movement within the field of view (FOV) of their Windows Mixed Reality headset. This is achieved using the sensors built into the headset.

To allow native Unity Editor support for Windows Mixed Reality input hardware, the Unity VR subsystem presents three inputs as separate joysticks. Use the UnityEngine.Input class to read the axis and button values of these inputs.

Controller naming conventions and detection

When properly configured and connected to your computer, the motion controllers appear in the list returned by UnityEngine.Input.GetJoystickNames() as Spatial Controller - Left and Spatial Controller - Right. For information on correctly configuring and connecting the motion controllers, see the Windows Developer Center documentation.

In Unity you can check the availability of the controllers through script by periodically checking for their presence in the list of joystick names. When the controllers are turned off, or their batteries are removed, an empty string replaces their name in the list returned by UnityEngine.Input.GetJoystickNames(). When the controllers are turned back on, their name re-appears in the list.

Unity Input system mappings

The image below shows the buttons available on your Windows Mixed Reality controller.

Windows Mixed Reality Controller buttons (image courtesy of developer.microsoft.com)
Windows Mixed Reality Controller buttons (image courtesy of developer.microsoft.com)

The table below shows the interaction types, button IDs, axis and value ranges for each input provided by the controller in Unity.

Hardware Feature Interaction Type Unity Button ID Unity Axis ID Unity Axis Value Range
Touchpad Touch Left: 18
Right: 19
- -
Touchpad Presionado Left: 16
Right: 17
- -
Touchpad Movimiento Horizontal - Left: 17
Right: 19
–1.0 to 1.0
Touchpad Movimiento Vertical - Left: 18
Right: 20
–1.0 to 1.0
Thumbstick Presionado Left: 8
Right: 9
- -
Thumbstick Movimiento Horizontal - Left: 1
Right: 4
–1.0 to 1.0
Thumbstick Movimiento Vertical - Left: 2
Right: 5
–1.0 to 1.0
Select Trigger Presionado Left: 14
Right: 15
- -
Select Trigger Apretar - Left: 9
Right: 10
0.0 to 1.0
Botón de agarre Presionado Left: 4
Right: 5
- -
Botón de agarre Apretar - Left: 11
Right: 12
0.0 and 1.0*
Menu button Presionado Left: 6
Right: 7
- -

Windows Mixed Reality controller input details for Unity

*The Grip squeeze axis is a binary control, so it only reports values of 0 or 1, with no values in between.

The table below lists the different axes available when using Window Mixed Reality controller inputs, along with the positive and negative directions for each axis.

Axis Positive Direction Negative Direction
Horizontal Left Right
Vertical Up Down

For more information on using the Windows MR motion controllers with Unity, visit the Windows Developer Center documentation on Motion Controllers in Unity.


  • 2017–11–21 Page published with editorial review

  • New functionality in 2017.2

Input XR de Unity
Entrada para controladores OpenVR
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961