What does scrollSensitivity actually mean for my input device?

Hi guys,
I want to know the exact ratio between the input device input data and the movement of the scroll view.
That’s to say, how does the scrollSensitivity control the pixels on my trackpad mapping to the distance on the UGUI canvases? What is the exact proportion?

ScrollRect.scrollSensitivity is just multiplied with the scroll delta received from the event system and applied to the anchored position of the rect transform.

If you’re using the old input manager with the StandaloneInputModule, then the scroll delta is used directly from Input.mouseScrollDelta. What exactly happens on the native side we don’t know.

The new input system and InputSystemUIInputModule seems to try to be consistent with the old input module and does some processing on the delta received from the input system: It divides its by InputSystem.scrollWheelDeltaPerTick (internal), which can be reported from the input system backend based on the operating system. Then it multiplies it by scrollDeltaPerTick (public), which defaults to 6. Judging from the comment in the source, this was chosen to match the old input module.

There seems to be an old assumption that scrolling happens in “ticks” of a scroll wheel on a mouse, probably because old OS APIs reported the scroll delta in lines rather than pixels.

Which leads us to the ultimate question, what exactly is a trackpad pixel? Does your trackpad even have pixels? How does the operating system report the raw hardware reading, what is the post-processing applied to it? How do the operating system track/scroll sensitivity settings affect the value?

The scroll delta value isn’t going to give you a useful unit. You don’t know what kind of trackpad it was generated with and what the size and resolution of that trackpad are. Or even if it’s coming from a mouse/trackpad at all. The scroll delta value is also more related to virtual “points” rather than “pixels”, due to high-dpi screens and custom UI scaling, which make “pixels” as unit mostly meaningless in UIs.

And on the Unity side, the value is applied in the local space of the scroll view. Which can be scaled arbitrarily and is inside of a Canvas with any kind of canvas scaler.

Your best bet is probably to set your canvas scaler to “Physical Size” and the “Physical Unit” to “Points”. This should make the os-reported value most relative to your in-canvas units, though Unity’s interpretation of “point” probably won’t always match that of the operating system. You can try to undo the processing the input system module applies but you’ll ultimately have to find some magic value that matches the value reported to the scale of your UI, so that the scrolling feels like it matches the rest of the operating system.

1 Like

Great explanation! Thank you Adrian, I think I will do a test for the exact proportion :smile: