Unity-Technologies / InputSystem

An efficient and versatile input system for Unity.
Other
1.42k stars 306 forks source link

CHANGE: Improve error logging when events get discarded (ISXB-691) #1929

Closed jfreire-unity closed 3 months ago

jfreire-unity commented 3 months ago

Description

Improves the error logging for the issue ISXB-691 with the amount of events processed by device.

Changes made

PR adds a way of accumulating the total amount of bytes processed during an update call, per device. Currently, this data will only be present when InputSettings.maxEventBytesPerUpdate is exceeded in an update call. But in the future, it could potentially be used as well to present the average of bytes processed per frame for a device in the Input Debugger Window

This logging of extra data will only affect development builds. It allows developers to identify the devices or other issues causing the error.

Notes

I did not see a performance impact when profiling this with the test CorePerformanceTest.Performance_Update10Gamepads.

To test this the error needs to be raised. Just decrease InputSystem.settings.maxEventBytesPerUpdate to something like 10 bytes. Try to see the difference between development builds and non-development builds.

Checklist

Before review:

During merge:

Pauliusd01 commented 3 months ago

Caught a crash when adding a gamepad in order to see what information the error will show. Adding the Editor.log and will try to repro it consistently

Editor.log

jfreire-unity commented 3 months ago

Caught a crash when adding a gamepad in order to see what information the error will show. Adding the Editor.log and will try to repro it consistently

Editor.log

Oh interesting. Which Gamepad by the way? Let me know once you manage to reproduce it

Pauliusd01 commented 3 months ago

Caught a crash when adding a gamepad in order to see what information the error will show. Adding the Editor.log and will try to repro it consistently Editor.log

Oh interesting. Which Gamepad by the way? Let me know once you manage to reproduce it

Xbox series x controller (I think that's the name for the latest one 😅)

jfreire-unity commented 3 months ago

@Pauliusd01 has detected some inconsistencies in logging with Xbox controllers on Windows, I'll investigate it once I get an Xbox controller

jfreire-unity commented 3 months ago

@Pauliusd01 you can retest with Xbox controllers on Windows

ekcoh commented 3 months ago

@jfreire-unity It would be great if you could post an example of what gets printed into t his PR, e.g. from your system when breaking the boundary (fine to set low)

jfreire-unity commented 3 months ago

@jfreire-unity It would be great if you could post an example of what gets printed into t his PR, e.g. from your system when breaking the boundary (fine to set low)

Added