docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Enum InputDeviceChange

    Indicates what type of change related to an input device occurred.

    Namespace: UnityEngine.InputSystem
    Assembly: Unity.InputSystem.dll
    Syntax
    public enum InputDeviceChange
    Remarks

    Use onDeviceChange 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;
            }
        };

    Fields

    Name Description
    Added

    A new device was added to the system. This is triggered after the device has already been added, i.e. it already appears on devices.

    See also AddDevice<TDevice>(string) and added.

    ConfigurationChanged

    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.

    See also DeviceConfigurationEvent and QueueConfigChangeEvent(InputDevice, double).

    Disabled

    An existing device was disabled.

    See also DisableDevice(InputDevice, bool) and enabled.

    Disconnected

    A device reported by the IInputRuntime was Removed but was retained by the system as disconnected.

    See also disconnectedDevices.

    Enabled

    An existing device was re-enabled after having been Disabled.

    See also EnableDevice(InputDevice) and enabled.

    HardReset

    Device is being "hard" reset, i.e. every control is reset to its default value. This happens only when explicitly forced through ResetDevice(InputDevice, bool).

    This notification is sent before the actual reset happens.

    Reconnected

    A device that was previously retained as Disconnected has been re-discovered and has been Added to the system again.

    See also disconnectedDevices.

    Removed

    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 devices.

    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 InputDevice instance from its list and remove the device's recorded input state.

    See also RemoveDevice(InputDevice).

    SoftReset

    Device is being "soft" reset but in a way that excludes dontReset controls such as mouse positions. This can happen during application focus changes (see backgroundBehavior) or when ResetDevice(InputDevice, bool) is called explicitly.

    This notification is sent before the actual reset happens.

    UsageChanged

    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.

    See also SetDeviceUsage(InputDevice, string) and usages.


    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Fields
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)