36 lines
924 B
C#
36 lines
924 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
using UnityEngine.InputSystem.Controls;
|
|
using UnityEngine.InputSystem.Layouts;
|
|
using UnityEngine.Scripting;
|
|
|
|
#if UNITY_EDITOR
|
|
[UnityEditor.InitializeOnLoad]
|
|
#endif
|
|
|
|
[Preserve,InputControlLayout(displayName = "CustomPicoHandDevice",commonUsages = new[] { "LeftHand","RightHand"})]
|
|
public class CustomPicoHandDevice : TrackedDevice
|
|
{
|
|
[InputControl]
|
|
public ButtonControl grabActive { get; private set; }
|
|
|
|
protected override void FinishSetup()
|
|
{
|
|
base.FinishSetup();
|
|
grabActive = GetChildControl<ButtonControl>(path: "grabActive");
|
|
}
|
|
|
|
static CustomPicoHandDevice()
|
|
{
|
|
InputSystem.RegisterLayout<CustomPicoHandDevice>();
|
|
}
|
|
|
|
[RuntimeInitializeOnLoadMethod]
|
|
public static void Initialize()
|
|
{
|
|
InputSystem.AddDevice<CustomPicoHandDevice>();
|
|
}
|
|
}
|