Skip to content

Commit a61bb93

Browse files
committed
Merge branch 'XR-Bug-Fixes' of github.com:StayTalm/InputSystem into inputsystem-wmr-fixes
# Conflicts: # Assets/Tests/InputSystem/Plugins/XRTests.cs # Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRSupport.cs # Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRTemplateBuilder.cs
2 parents c0e9c15 + c5e910f commit a61bb93

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

Assets/Tests/InputSystem/Plugins/XRTests.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
using UnityEngine.InputSystem.Controls;
1111
using UnityEngine.InputSystem.Layouts;
1212
using UnityEngine.InputSystem.LowLevel;
13+
using UnityEngine.XR;
14+
15+
using Usages = UnityEngine.InputSystem.CommonUsages;
1316

1417
using InputDeviceRole = UnityEngine.XR.InputDeviceRole;
1518

@@ -20,10 +23,10 @@ internal class XRTests : InputTestFixture
2023
[TestCase(InputDeviceRole.Generic, "XRHMD", typeof(XRHMD))]
2124
[TestCase(InputDeviceRole.LeftHanded, "XRController", typeof(XRController))]
2225
[TestCase(InputDeviceRole.RightHanded, "XRController", typeof(XRController))]
23-
[TestCase(InputDeviceRole.HardwareTracker, null, typeof(InputDevice))]
24-
[TestCase(InputDeviceRole.TrackingReference, null, typeof(InputDevice))]
25-
[TestCase(InputDeviceRole.GameController, null, typeof(InputDevice))]
26-
[TestCase(InputDeviceRole.Unknown, null, typeof(InputDevice))]
26+
[TestCase(InputDeviceRole.HardwareTracker, null, typeof(UnityEngine.InputSystem.InputDevice))]
27+
[TestCase(InputDeviceRole.TrackingReference, null, typeof(UnityEngine.InputSystem.InputDevice))]
28+
[TestCase(InputDeviceRole.GameController, null, typeof(UnityEngine.InputSystem.InputDevice))]
29+
[TestCase(InputDeviceRole.Unknown, null, typeof(UnityEngine.InputSystem.InputDevice))]
2730
public void Devices_XRDeviceRoleDeterminesTypeOfDevice(InputDeviceRole role, string baseLayoutName, Type expectedType)
2831
{
2932
var deviceDescription = CreateSimpleDeviceDescriptionByRole(role);
@@ -53,15 +56,15 @@ public void Devices_CanChangeHandednessOfXRController()
5356

5457
var controller = InputSystem.devices[0];
5558

56-
Assert.That(controller.usages, Has.Exactly(1).EqualTo(CommonUsages.LeftHand));
57-
Assert.That(controller.usages, Has.Exactly(0).EqualTo(CommonUsages.RightHand));
59+
Assert.That(controller.usages, Has.Exactly(1).EqualTo(Usages.LeftHand));
60+
Assert.That(controller.usages, Has.Exactly(0).EqualTo(Usages.RightHand));
5861
Assert.That(XRController.rightHand, Is.Null);
5962
Assert.That(XRController.leftHand, Is.EqualTo(controller));
6063

61-
InputSystem.SetDeviceUsage(controller, CommonUsages.RightHand);
64+
InputSystem.SetDeviceUsage(controller, Usages.RightHand);
6265

63-
Assert.That(controller.usages, Has.Exactly(0).EqualTo(CommonUsages.LeftHand));
64-
Assert.That(controller.usages, Has.Exactly(1).EqualTo(CommonUsages.RightHand));
66+
Assert.That(controller.usages, Has.Exactly(0).EqualTo(Usages.LeftHand));
67+
Assert.That(controller.usages, Has.Exactly(1).EqualTo(Usages.RightHand));
6568
Assert.That(XRController.rightHand, Is.EqualTo(controller));
6669
Assert.That(XRController.leftHand, Is.Null);
6770
}
@@ -364,7 +367,7 @@ public void Layouts_ButtonsArePackedByTheByte_WhileLargerStructuresAreFourByteAl
364367
}
365368

366369
[InputControlLayout(updateBeforeRender = true)]
367-
private class TestHMD : InputDevice
370+
private class TestHMD : UnityEngine.InputSystem.InputDevice
368371
{
369372
[InputControl]
370373
public QuaternionControl quaternion { get; private set; }
@@ -476,7 +479,7 @@ private static InputDeviceDescription CreateSimpleDeviceDescriptionByRole(InputD
476479
capabilities = new XRDeviceDescriptor
477480
{
478481
#if !UNITY_2019_3_OR_NEWER
479-
InputDeviceRole = role,
482+
deviceRole = role,
480483
#endif
481484
inputFeatures = new List<XRFeatureDescriptor>()
482485
{
@@ -500,7 +503,7 @@ private static InputDeviceDescription CreateMangledNameDeviceDescription()
500503
capabilities = new XRDeviceDescriptor
501504
{
502505
#if !UNITY_2019_3_OR_NEWER
503-
deviceRole = DeviceRole.Generic,
506+
deviceRole = InputDeviceRole.Generic,
504507
#endif
505508

506509
inputFeatures = new List<XRFeatureDescriptor>()
@@ -537,7 +540,7 @@ public static InputDeviceDescription CreateDeviceDescription()
537540
capabilities = new XRDeviceDescriptor
538541
{
539542
#if !UNITY_2019_3_OR_NEWER
540-
deviceRole = DeviceRole.Generic,
543+
deviceRole = InputDeviceRole.Generic,
541544
#endif
542545
inputFeatures = new List<XRFeatureDescriptor>()
543546
{
@@ -614,7 +617,7 @@ public static InputDeviceDescription CreateDeviceDescription()
614617
capabilities = new XRDeviceDescriptor
615618
{
616619
#if !UNITY_2019_3_OR_NEWER
617-
deviceRole = DeviceRole.Generic,
620+
deviceRole = InputDeviceRole.Generic,
618621
#endif
619622
inputFeatures = new List<XRFeatureDescriptor>()
620623
{

Packages/com.unity.inputsystem/InputSystem/Plugins/XR/GenericXRDevice.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ protected override void FinishSetup()
4848
else if ((deviceDescriptor.characteristics & InputDeviceCharacteristics.Right) != 0)
4949
InputSystem.SetDeviceUsage(this, CommonUsages.RightHand);
5050
#else
51-
if (deviceDescriptor.deviceRole == DeviceRole.LeftHanded)
51+
if (deviceDescriptor.deviceRole == InputDeviceRole.LeftHanded)
5252
InputSystem.SetDeviceUsage(this, CommonUsages.LeftHand);
53-
else if (deviceDescriptor.deviceRole == DeviceRole.RightHanded)
53+
else if (deviceDescriptor.deviceRole == InputDeviceRole.RightHanded)
5454
InputSystem.SetDeviceUsage(this, CommonUsages.RightHand);
5555
#endif
5656
}

Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRTemplateBuilder.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
using UnityEngine.InputSystem.Utilities;
55
using System.Text;
66
using UnityEngine.InputSystem.Layouts;
7-
#if UNITY_INPUT_SYSTEM_ENABLE_XR
87
using UnityEngine.XR;
9-
#endif
108

119
namespace UnityEngine.InputSystem.XR
1210
{

0 commit comments

Comments
 (0)