#if ENABLE_VR || UNITY_GAMECORE || PACKAGE_DOCS_GENERATION
using UnityEngine.InputSystem.Layouts;
using UnityEngine.Scripting;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngine.XR.Interaction.Toolkit.Inputs.Simulation
{
///
/// This class automatically registers control layouts used by the .
///
///
///
#if UNITY_EDITOR
[InitializeOnLoad]
#endif
[Preserve]
public static class SimulatedInputLayoutLoader
{
[Preserve]
static SimulatedInputLayoutLoader()
{
RegisterInputLayouts();
}
///
/// See .
///
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad), Preserve]
public static void Initialize()
{
// Will execute the static constructor as a side effect.
}
static void RegisterInputLayouts()
{
// See XRDeviceSimulator.AddDevices for product pattern
InputSystem.InputSystem.RegisterLayout(
matches: new InputDeviceMatcher()
.WithProduct(nameof(XRSimulatedHMD)));
InputSystem.InputSystem.RegisterLayout(
matches: new InputDeviceMatcher()
.WithProduct(nameof(XRSimulatedController)));
}
}
}
#endif