Problem with scrollview which contains buttons

Hello, I am developing mobile game with UI toolkit, But I am experiencing some problems with the Scrollview. I have level select screen based on vertical Scrollview which contains all game sets obtained in the game. Every set contain a classic level progress tree with buttons. So player is scrolling to wanted game set and after that is opening level by clicking to corresponding button.

My problem is, that when is scroll view decelerating and I am clicking to button, it will only stops scrolling/decelerating and don´t trigger button. I know, that in high speed it is wanted behaviour, but it is happening too in very low speed. In some cases I am not seeing any movement and still click to button is not registered and probably only deceleration is stopped… so for registering button I need to click twice or wait some time… Is there any possibility to remove this very low speed deceleration on end (I want to keep deceleration but remove part which is harder to detect by eye)? I want to remove, that player must to click twice on button.

Another thing is, that when is Touch scroll type set to Clamped and I will make big scroll, which hit one end side of scroll view, it will visually instanly stop scrolling, but I have feeling, that internaly it is still thinking, that decelerating is underway, because if I will “shortly” click to button, it will again not trigger anything and I need to click twice…or wait little longer and after that is click registered.

I am usingTouch scroll type Elastic so second point about clamped type is not important for me.
Again thank you very much for your help! :heart:

Really interesting input, thanks!

The scrollview uses an exponential decay that stops when a speed of 10 pixel per second is reached. That final speed has not been made public voluntarily.

So upon touch, the you should be able to intercept the touch event above in the hierarchy in the tickle down phase, look for the current velocity of the scrollview, trigger the stop manually, and not consume the event.

Since we don’t expose the velocity, you will have to differentiate the scrollOffset through time, and call programmatically the immediate dispatch of a drag event. That way the scrollview should be already stopped when the event goes through and it will click the button.

I will be honest, It is not a nice workflow. I feel like we should introduce methods to manually get/set the velocity for better animations and share this with the relevant peoples internally. I would not expect any improvements on this to land in the Unity 6 branch. If you can fill a request on the product roadmap it is another way to remind us about this.

For quick reference, here is how it is processed:


 var scaledSpeedLimit = scaledPixelsPerPoint * k_ScaledPixelsPerPointMultiplier;

 if (Mathf.Abs(m_Velocity.x) <= scaledSpeedLimit ||
     touchScrollBehavior == TouchScrollBehavior.Elastic && (scrollOffset.x < m_LowBounds.x || scrollOffset.x > m_HighBounds.x))
 {
     m_Velocity.x = 0;
 }

 if (Mathf.Abs(m_Velocity.y) <= scaledSpeedLimit ||
     touchScrollBehavior == TouchScrollBehavior.Elastic && (scrollOffset.y < m_LowBounds.y || scrollOffset.y > m_HighBounds.y))
 {
     m_Velocity.y = 0;
 }