45 lines
1006 B
C#
45 lines
1006 B
C#
|
|
#if UNITY_INPUT_SYSTEM
|
||
|
|
using UnityEngine.InputSystem;
|
||
|
|
using UnityEngine.InputSystem.Layouts;
|
||
|
|
using UnityEngine.InputSystem.XR;
|
||
|
|
using UnityEngine.XR;
|
||
|
|
using UnityEngine.XR.ARSubsystems;
|
||
|
|
|
||
|
|
using Inputs = UnityEngine.InputSystem.InputSystem;
|
||
|
|
|
||
|
|
#if UNITY_EDITOR
|
||
|
|
using UnityEditor;
|
||
|
|
#endif
|
||
|
|
|
||
|
|
namespace UnityEngine.XR.ARKit
|
||
|
|
{
|
||
|
|
#if UNITY_EDITOR
|
||
|
|
[InitializeOnLoad]
|
||
|
|
#endif
|
||
|
|
public class InputLayoutLoader
|
||
|
|
{
|
||
|
|
#if UNITY_EDITOR
|
||
|
|
static InputLayoutLoader()
|
||
|
|
{
|
||
|
|
RegisterLayouts();
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||
|
|
static void RegisterLayouts()
|
||
|
|
{
|
||
|
|
#if !UNITY_EDITOR
|
||
|
|
if (!Api.AtLeast11_0())
|
||
|
|
return;
|
||
|
|
#endif
|
||
|
|
|
||
|
|
Inputs.RegisterLayout<HandheldARInputDevice>(
|
||
|
|
matches: new InputDeviceMatcher()
|
||
|
|
.WithInterface(XRUtilities.InterfaceMatchAnyVersion)
|
||
|
|
.WithProduct("(ARKit)")
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
#endif
|