Skip to content

Commit f855a6d

Browse files
committed
add new enum like we do for FeatureType
1 parent 23e316a commit f855a6d

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ public class XRController : TrackedDevice
112112
protected override void FinishSetup()
113113
{
114114
base.FinishSetup();
115-
#if UNITY_INPUT_SYSTEM_ENABLE_XR
116115
var capabilities = description.capabilities;
117116
var deviceDescriptor = XRDeviceDescriptor.FromJson(capabilities);
118117

@@ -123,7 +122,6 @@ protected override void FinishSetup()
123122
else if ((deviceDescriptor.characteristics & InputDeviceCharacteristics.Right) != 0)
124123
InputSystem.SetDeviceUsage(this, CommonUsages.RightHand);
125124
}
126-
#endif
127125
}
128126
}
129127

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ internal static string OnFindLayoutForDevice(ref InputDeviceDescription descript
8888
{
8989
return null;
9090
}
91-
#if UNITY_INPUT_SYSTEM_ENABLE_XR
91+
9292
if (string.IsNullOrEmpty(matchedLayout))
9393
{
9494
const InputDeviceCharacteristics controllerCharacteristics = InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.Controller;
@@ -97,7 +97,7 @@ internal static string OnFindLayoutForDevice(ref InputDeviceDescription descript
9797
else if ((deviceDescriptor.characteristics & controllerCharacteristics) == controllerCharacteristics)
9898
matchedLayout = "XRController";
9999
}
100-
#endif
100+
101101
string layoutName;
102102
if (string.IsNullOrEmpty(description.manufacturer))
103103
{

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

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using UnityEngine.InputSystem.Layouts;
44
using UnityEngine.InputSystem.Controls;
5-
using UnityEngine.XR;
65

76
namespace UnityEngine.InputSystem.XR
87
{
@@ -45,6 +44,27 @@ public enum FeatureType
4544
Eyes
4645
}
4746

47+
// Sync to InputDeviceCharacteristics in IUnityXRInput.h
48+
/// <summary>
49+
/// The type of data a <see cref="XRDeviceDescriptor"/> exposes.
50+
/// </summary>
51+
[Flags]
52+
public enum InputDeviceCharacteristics : uint
53+
{
54+
None = 0,
55+
HeadMounted = 1 << 0,
56+
Camera = 1 << 1,
57+
HeldInHand = 1 << 2,
58+
HandTracking = 1 << 3,
59+
EyeTracking = 1 << 4,
60+
TrackedDevice = 1 << 5,
61+
Controller = 1 << 6,
62+
TrackingReference = 1 << 7,
63+
Left = 1 << 8,
64+
Right = 1 << 9,
65+
Simulated6DOF = 1 << 10
66+
}
67+
4868
/// <summary>
4969
/// Contextual strings that identify the contextual, cross-platform use that a feature represents. <see cref="UnityEngine.XR.CommonUsages"/> for a list of unity's built-in shared usages.
5070
/// </summary>
@@ -102,12 +122,8 @@ public class XRDeviceDescriptor
102122
/// <summary>
103123
/// The capabilities of the device, used to help filter and identify devices that server a certain purpose (e.g. controller, or headset, or hardware tracker).
104124
/// </summary>
105-
#if UNITY_INPUT_SYSTEM_ENABLE_XR
106125
public InputDeviceCharacteristics characteristics;
107-
#else
108-
[SerializeField]
109-
private uint characteristics;
110-
#endif
126+
111127
/// <summary>
112128
/// The underlying deviceId, this can be used with <see cref="UnityEngine.XR.InputDevices"/> to create a device.
113129
/// </summary>

0 commit comments

Comments
 (0)