Make scrolling move faster in scrollRect?

Sorry to necro-post this thread, but I made a quick patch to the Unity ScrollRect to get faster-than-finger scrolling. It is AWESOME on mobile.

It is EXTREMELY useful when you have large images of content, and yet you want to quickly go through them without having to whip them along “ballistically.”

(This link updated 6:36 AM 3/13/2021, along with the line numbers below)

If you go to this file:

(This file is also available from the Unity Package Manager.)

Then you can download ScrollRect.cs and modify it to make your own that supports higher-than-finger scroll rates. Once you use it, every other scroll rate with 1:1 finger mapping (i.e., normal Apple / Android scroll rates) just feels glacially slow.

I recommend renaming the class and filename, such as “MyScrollRect.cs” and of course the internal MonoBehavior itself.

The first patch is about line 104 in the property declarations, add these two lines:

[SerializeField]
private float m_ScrollFactor = 1.0f;
public float scrollFactor { get { return m_ScrollFactor; } set { m_ScrollFactor = value; } }

The second patch is inside the OnDrag() method, approximately line 763 in the original file, AFTER the pointerDelta is calculated, but before it is used to calculate position:

var pointerDelta = localCursor - m_PointerStartLocalCursor;
pointerDelta *= m_ScrollFactor;    // this line is new!
Vector2 position = m_ContentStartPosition + pointerDelta;

Now you’re done. Use this newly-named ScrollRect anywhere you would use the Unity one and you can have faster-than-finger (or faster-than-mouse drag) scrolling. It’s awesome if I do say so myself!

22 Likes