Currently when you scroll something in a scrollRect, by using the mouse, touch etc., it’s on a 1:1 basis.
Move the mouse 100 pixels, and the content is scrolled 100 pixels.
Is there a way to e.g. double this?
So when moving the mouse (or dragging when using touch) 100 pixels, the content is scrolled 200 pixels.
I guess I’m looking for a multiplier or something, but I don’t know where to find it, or how to achieve it.
Hope someone can help me
Again it’s scrolling speed when scrolling I’m after (when touching and scrolling) - not deceleration, which occurs after you’ve scrolled (released touch). There’s no deceleration occuring when you’re actively scrolling obviously.
So, normally when you scroll with your finger the user is “dragging” the window in the direction they’re moving their finger. It gives the illusion that they’re physically dragging the object. I implemented my own drag feature quite easily but my first iteration had the speed too high. Every pixel I moved my finger the object underneath moved 2. It was a really, really awkward feeling.
Basically, I don’t think you want what you’re asking for. Every app I’ve ever used, game or not, you just flicked the contents up really fast and let is scroll for a long time if you wanted to scroll quickly. Reduce the deceleration time so people can flick, call it good. No one will think, “Golly I wish this was faster” except you, most likely.
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!