Hello ! I am practicing UI Toolkit on mobile devices and encountered a strange bug when using a different device.
When a PanelSettings Scale Mode is set to something different from Constant Pixel Size, all touch inputs seem to be offset. The issue occurs on actual devices but can be reproduced in the Device Simulator.
Here is an example :
In this document, I registered each VisualElement to PointerDown and PointerUp events. The ScaleMode is set to Scale With Screen Size, Match Mode is set to Height.
In the console, I display the name of the element receiving event and the pointerType of the event.
The screenshot shows what happened after clicking inside the orange rectangle.
By the way, for each up or down event, there are :
- two mouse events and one touch event, in the Device Simulator.
- one mouse event and one touch event, on an actual device.
I am not sure if this is normal behaviour.
- When ScaleMode is set to Scale With Screen Size, it seems that touch input are offset when the screen resolution is different from the reference resolution.
- When ScaleMode is set to ConstantPhysicalSize, no touch input event is received.
I am not sure what is the correct way to register to input event on mobile with UI Toolkit, but it seems that something is going wrong with touch input. This issue also impacts other controls like buttons. I haven’t tried yet to debug what is going on inside the EventSystem