InputDiagnostics.cs 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #if UNITY_EDITOR
  2. using UnityEngine.InputSystem.LowLevel;
  3. namespace UnityEngine.InputSystem.Editor
  4. {
  5. internal class InputDiagnostics : IInputDiagnostics
  6. {
  7. public void OnCannotFindDeviceForEvent(InputEventPtr eventPtr)
  8. {
  9. Debug.LogError("Cannot find device for input event: " + eventPtr);
  10. }
  11. public void OnEventTimestampOutdated(InputEventPtr eventPtr, InputDevice device)
  12. {
  13. Debug.LogError(
  14. $"'{eventPtr.type}' input event {eventPtr.id} for device '{device}' is outdated (event time: {eventPtr.time}, device time: {device.lastUpdateTime})");
  15. }
  16. public void OnEventFormatMismatch(InputEventPtr eventPtr, InputDevice device)
  17. {
  18. Debug.LogError(
  19. $"'{eventPtr.type}' input event {eventPtr.id} for device '{device}' has incorrect format (event format: '{eventPtr.type}', device format: '{device.stateBlock.format}')");
  20. }
  21. public void OnEventForDisabledDevice(InputEventPtr eventPtr, InputDevice device)
  22. {
  23. Debug.LogError($"Device '{device}' received input event '{eventPtr}' but the device is disabled");
  24. }
  25. }
  26. }
  27. #endif // UNITY_EDITOR