No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InputDeviceChange.cs 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. using System;
  2. using UnityEngine.InputSystem.LowLevel;
  3. using UnityEngine.InputSystem.Utilities;
  4. namespace UnityEngine.InputSystem
  5. {
  6. /// <summary>
  7. /// Indicates what type of change related to an <see cref="InputDevice">input device</see> occurred.
  8. /// </summary>
  9. /// <remarks>
  10. /// Use <see cref="InputSystem.onDeviceChange"/> to receive notifications about changes
  11. /// to the input device setup in the system.
  12. ///
  13. /// <example>
  14. /// <code>
  15. /// InputSystem.onDeviceChange +=
  16. /// (device, change) =>
  17. /// {
  18. /// switch (change)
  19. /// {
  20. /// case InputDeviceChange.Added:
  21. /// Debug.Log($"Device {device} was added");
  22. /// break;
  23. /// case InputDeviceChange.Removed:
  24. /// Debug.Log($"Device {device} was removed");
  25. /// break;
  26. /// }
  27. /// };
  28. /// </code>
  29. /// </example>
  30. /// </remarks>
  31. public enum InputDeviceChange
  32. {
  33. /// <summary>
  34. /// A new device was added to the system. This is triggered <em>after</em> the device
  35. /// has already been added, i.e. it already appears on <see cref="InputSystem.devices"/>.
  36. ///
  37. /// See also <see cref="InputSystem.AddDevice{TDevice}(string)"/> and <see cref="InputDevice.added"/>.
  38. /// </summary>
  39. Added,
  40. /// <summary>
  41. /// An existing device was removed from the system. This is triggered <em>after</em> the
  42. /// device has already been removed, i.e. it already has been cleared from <see cref="InputSystem.devices"/>.
  43. ///
  44. /// Other than when a device is removed programmatically, this happens when a device
  45. /// is unplugged from the system. Subsequent to the notification, the system will remove
  46. /// the <see cref="InputDevice"/> instance from its list and remove the device's
  47. /// recorded input state.
  48. ///
  49. /// See also <see cref="InputSystem.RemoveDevice"/>.
  50. /// </summary>
  51. Removed,
  52. /// <summary>
  53. /// A device reported by the <see cref="IInputRuntime"/> was <see cref="Removed"/> but was
  54. /// retained by the system as <see cref="InputSystem.disconnectedDevices">disconnected</see>.
  55. ///
  56. /// See also <see cref="InputSystem.disconnectedDevices"/>.
  57. /// </summary>
  58. Disconnected,
  59. /// <summary>
  60. /// A device that was previously retained as <see cref="Disconnected"/> has been re-discovered
  61. /// and has been <see cref="Added"/> to the system again.
  62. ///
  63. /// See also <see cref="InputSystem.disconnectedDevices"/>.
  64. /// </summary>
  65. Reconnected,
  66. /// <summary>
  67. /// An existing device was re-enabled after having been <see cref="Disabled"/>.
  68. ///
  69. /// See also <see cref="InputSystem.EnableDevice"/> and <see cref="InputDevice.enabled"/>.
  70. /// </summary>
  71. Enabled,
  72. /// <summary>
  73. /// An existing device was disabled.
  74. ///
  75. /// See also <see cref="InputSystem.DisableDevice"/> and <see cref="InputDevice.enabled"/>.
  76. /// </summary>
  77. Disabled,
  78. /// <summary>
  79. /// The usages on a device have changed.
  80. ///
  81. /// This may signal, for example, that what was the right hand XR controller before
  82. /// is now the left hand controller.
  83. ///
  84. /// See also <see cref="InputSystem.SetDeviceUsage(InputDevice,string)"/> and
  85. /// <see cref="InputControl.usages"/>.
  86. /// </summary>
  87. UsageChanged,
  88. /// <summary>
  89. /// The configuration of a device has changed.
  90. ///
  91. /// This may signal, for example, that the layout used by the keyboard has changed or
  92. /// that, on a console, a gamepad has changed which player ID(s) it is assigned to.
  93. ///
  94. /// See also <see cref="DeviceConfigurationEvent"/> and <see cref="InputSystem.QueueConfigChangeEvent"/>.
  95. /// </summary>
  96. ConfigurationChanged,
  97. /// <summary>
  98. /// Device is being "soft" reset but in a way that excludes <see cref="Layouts.InputControlLayout.ControlItem.dontReset"/>
  99. /// controls such as mouse positions. This can happen during application focus changes
  100. /// (see <see cref="InputSettings.backgroundBehavior"/>) or when <see cref="InputSystem.ResetDevice"/>
  101. /// is called explicitly.
  102. ///
  103. /// This notification is sent before the actual reset happens.
  104. /// </summary>
  105. SoftReset,
  106. /// <summary>
  107. /// Device is being "hard" reset, i.e. every control is reset to its default value. This happens only
  108. /// when explicitly forced through <see cref="InputSystem.ResetDevice"/>.
  109. ///
  110. /// This notification is sent before the actual reset happens.
  111. /// </summary>
  112. HardReset,
  113. [Obsolete("Destroyed enum has been deprecated.")]
  114. Destroyed,
  115. }
  116. }