diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/GenericXRDevice.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/GenericXRDevice.cs index f1c1666d28..7fc2e87f6d 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/GenericXRDevice.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/GenericXRDevice.cs @@ -112,7 +112,6 @@ public class XRController : TrackedDevice protected override void FinishSetup() { base.FinishSetup(); -#if UNITY_INPUT_SYSTEM_ENABLE_XR var capabilities = description.capabilities; var deviceDescriptor = XRDeviceDescriptor.FromJson(capabilities); @@ -123,7 +122,6 @@ protected override void FinishSetup() else if ((deviceDescriptor.characteristics & InputDeviceCharacteristics.Right) != 0) InputSystem.SetDeviceUsage(this, CommonUsages.RightHand); } -#endif } } diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRLayoutBuilder.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRLayoutBuilder.cs index b5715ba6e8..620377c0ba 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRLayoutBuilder.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRLayoutBuilder.cs @@ -88,7 +88,7 @@ internal static string OnFindLayoutForDevice(ref InputDeviceDescription descript { return null; } -#if UNITY_INPUT_SYSTEM_ENABLE_XR + if (string.IsNullOrEmpty(matchedLayout)) { const InputDeviceCharacteristics controllerCharacteristics = InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.Controller; @@ -97,7 +97,7 @@ internal static string OnFindLayoutForDevice(ref InputDeviceDescription descript else if ((deviceDescriptor.characteristics & controllerCharacteristics) == controllerCharacteristics) matchedLayout = "XRController"; } -#endif + string layoutName; if (string.IsNullOrEmpty(description.manufacturer)) { diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRSupport.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRSupport.cs index 5a2721bfb2..e3a022b28a 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRSupport.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRSupport.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using UnityEngine.InputSystem.Layouts; using UnityEngine.InputSystem.Controls; -using UnityEngine.XR; namespace UnityEngine.InputSystem.XR { @@ -45,6 +44,27 @@ public enum FeatureType Eyes } + // Sync to InputDeviceCharacteristics in IUnityXRInput.h + /// + /// The type of data a exposes. + /// + [Flags] + public enum InputDeviceCharacteristics : uint + { + None = 0, + HeadMounted = 1 << 0, + Camera = 1 << 1, + HeldInHand = 1 << 2, + HandTracking = 1 << 3, + EyeTracking = 1 << 4, + TrackedDevice = 1 << 5, + Controller = 1 << 6, + TrackingReference = 1 << 7, + Left = 1 << 8, + Right = 1 << 9, + Simulated6DOF = 1 << 10 + } + /// /// Contextual strings that identify the contextual, cross-platform use that a feature represents. for a list of unity's built-in shared usages. /// @@ -102,12 +122,8 @@ public class XRDeviceDescriptor /// /// 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). /// -#if UNITY_INPUT_SYSTEM_ENABLE_XR public InputDeviceCharacteristics characteristics; -#else - [SerializeField] - private uint characteristics; -#endif + /// /// The underlying deviceId, this can be used with to create a device. ///