概要
using System;
using UnityEngine;
using UnityEngine.InputSystem;
public class Example : MonoBehaviour
{
private void Awake()
{
InputSystem.onDeviceChange += ( device, change ) =>
{
Debug.Log( $"[onDeviceChange] {device}, {change}" );
switch ( change )
{
case InputDeviceChange.Added: break;
case InputDeviceChange.Removed: break;
case InputDeviceChange.Disconnected: break;
case InputDeviceChange.Reconnected: break;
case InputDeviceChange.Enabled: break;
case InputDeviceChange.Disabled: break;
case InputDeviceChange.UsageChanged: break;
case InputDeviceChange.ConfigurationChanged: break;
case InputDeviceChange.SoftReset: break;
case InputDeviceChange.HardReset: break;
default: throw new ArgumentOutOfRangeException( nameof( change ), change, null );
}
};
}
}