2026-06-17 스타터킷,툰셰이더,오른손
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR;
|
||||
using XRInputDevice = UnityEngine.XR.InputDevice;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.XR.Interaction.Toolkit.Interactors;
|
||||
using InputDevice = UnityEngine.XR.InputDevice;
|
||||
|
||||
namespace UnityEngine.XR.Interaction.Toolkit.Samples.StarterAssets
|
||||
namespace XR.Interaction.Toolkit.Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages input fallback for <see cref="XRGazeInteractor"/> when eye tracking is not available.
|
||||
@@ -33,7 +38,7 @@ public bool fallbackIfEyeTrackingUnavailable
|
||||
protected void Awake()
|
||||
{
|
||||
// Check if we have eye tracking support
|
||||
var inputDeviceList = new List<InputDevice>();
|
||||
var inputDeviceList = new List<XRInputDevice>();
|
||||
InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.EyeTracking, inputDeviceList);
|
||||
if (inputDeviceList.Count > 0)
|
||||
{
|
||||
@@ -42,7 +47,7 @@ protected void Awake()
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var device in InputSystem.InputSystem.devices)
|
||||
foreach (var device in InputSystem.devices)
|
||||
{
|
||||
if (device.layout == k_EyeGazeLayoutName)
|
||||
{
|
||||
@@ -55,18 +60,18 @@ protected void Awake()
|
||||
Debug.LogWarning($"Could not find a device that supports eye tracking on Awake. {this} has subscribed to device connected events and will activate the GameObject when an eye tracking device is connected.", this);
|
||||
|
||||
InputDevices.deviceConnected += OnDeviceConnected;
|
||||
InputSystem.InputSystem.onDeviceChange += OnDeviceChange;
|
||||
InputSystem.onDeviceChange += OnDeviceChange;
|
||||
|
||||
gameObject.SetActive(m_FallbackIfEyeTrackingUnavailable);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// See <see cref="MonoBehaviour"/>.
|
||||
/// </summary>
|
||||
protected void OnDestroy()
|
||||
{
|
||||
InputDevices.deviceConnected -= OnDeviceConnected;
|
||||
InputSystem.InputSystem.onDeviceChange -= OnDeviceChange;
|
||||
InputSystem.onDeviceChange -= OnDeviceChange;
|
||||
}
|
||||
|
||||
void OnDeviceConnected(InputDevice inputDevice)
|
||||
@@ -79,7 +84,7 @@ void OnDeviceConnected(InputDevice inputDevice)
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
void OnDeviceChange(InputSystem.InputDevice device, InputDeviceChange change)
|
||||
void OnDeviceChange(UnityEngine.InputSystem.InputDevice device, InputDeviceChange change)
|
||||
{
|
||||
if (m_EyeTrackingDeviceFound || change != InputDeviceChange.Added)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user