using UnityEngine.InputSystem.LowLevel; using UnityEngine.InputSystem.Utilities; namespace UnityEngine.InputSystem { /// /// Indicates what type of change related to an input device occurred. /// /// /// Use to receive notifications about changes /// to the input device setup in the system. /// /// /// /// InputSystem.onDeviceChange += /// (device, change) => /// { /// switch (change) /// { /// case InputDeviceChange.Added: /// Debug.Log($"Device {device} was added"); /// break; /// case InputDeviceChange.Removed: /// Debug.Log($"Device {device} was removed"); /// break; /// } /// }; /// /// /// public enum InputDeviceChange { /// /// A new device was added to the system. This is triggered after the device /// has already been added, i.e. it already appears on . /// /// /// /// Added, /// /// An existing device was removed from the system. This is triggered after the /// device has already been removed, i.e. it already has been cleared from . /// /// /// Other than when a device is removed programmatically, this happens when a device /// is unplugged from the system. Subsequent to the notification, the system will remove /// the instance from its list and remove the device's /// recorded input state. /// /// Removed, /// /// A device reported by the was but was /// retained by the system as disconnected. /// /// Disconnected, /// /// A device that was previously retained as has been re-discovered /// and has been to the system again. /// /// /// Reconnected, /// /// An existing device was re-enabled after having been . /// /// /// Enabled, /// /// An existing device was disabled. /// /// /// Disabled, /// /// The usages on a device have changed. /// /// /// This may signal, for example, that what was the right hand XR controller before /// is now the left hand controller. /// /// /// UsageChanged, /// /// The configuration of a device has changed. /// /// /// This may signal, for example, that the layout used by the keyboard has changed or /// that, on a console, a gamepad has changed which player ID(s) it is assigned to. /// /// /// ConfigurationChanged, ////TODO: fire this when we purge disconnected devices Destroyed, } }