Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -123,7 +122,6 @@ protected override void FinishSetup()
else if ((deviceDescriptor.characteristics & InputDeviceCharacteristics.Right) != 0)
InputSystem.SetDeviceUsage(this, CommonUsages.RightHand);
}
#endif
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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))
{
Expand Down
28 changes: 22 additions & 6 deletions Packages/com.unity.inputsystem/InputSystem/Plugins/XR/XRSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.Controls;
using UnityEngine.XR;

namespace UnityEngine.InputSystem.XR
{
Expand Down Expand Up @@ -45,6 +44,27 @@ public enum FeatureType
Eyes
}

// Sync to InputDeviceCharacteristics in IUnityXRInput.h
/// <summary>
/// The type of data a <see cref="XRDeviceDescriptor"/> exposes.
/// </summary>
[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
}

/// <summary>
/// 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.
/// </summary>
Expand Down Expand Up @@ -102,12 +122,8 @@ public class XRDeviceDescriptor
/// <summary>
/// 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).
/// </summary>
#if UNITY_INPUT_SYSTEM_ENABLE_XR
public InputDeviceCharacteristics characteristics;
#else
[SerializeField]
private uint characteristics;
#endif

/// <summary>
/// The underlying deviceId, this can be used with <see cref="UnityEngine.XR.InputDevices"/> to create a device.
/// </summary>
Expand Down
Loading