Download

Touch Scrolling with UMG

I am currently working on a game for mobile and have it so that there is a scrollbox on the level select screen (in UMG). Using blueprints, I have made it so that the scrollbox can be used by touching and dragging to scroll, thanks to the help of this thread:

My issue is that if I first touch a button to try to scroll, the “button pressed” event intercepts my input, so scrolling does not work. How would I ignore the button presses so that if a finger is moved, scrolling would begin? Then, if a button is tapped, the “button pressed” event fires. An example of what I mean is in the app “Words with Friends” (I’m sure there are many others as well).

On touch/mobile you can use button released instead of button pressed, this allows you to determine if a drag has occurred between pressed and released then therefore do one or the other.

Thanks for the response. If I were to use “button released” how would I be able to tell if there was finger movement from “button pressed” to “button released?” UMG widgets don’t have the “touch input” event that can detect when a finger is on the screen.

I saw the overridable functions “OnTouchStarted”, “OnTouchEnded”, and “OnTouchMoved” in the widget blueprint. These seem to have the same problem as above, where they will not be called if my first touch is on a button. From these OnTouch events I am able to “GetScreenSpacePosition” of the touch, so is it possible to somehow have these functions be called when a button’s “onpressed” event is called? Then, if there is no movement detected, I would use “onreleased” to call the button’s functionality.

Have you set the Interaction on you button to Precise Click/Tap?

cbf55a3e8b01c1d6796968f324034910e2ae4b50.png

That’s exactly what I needed, thanks!

Whoo! glad I could help :slight_smile:

Thank you man!It also sloved my problem~ :wink:

The link is dead, can you re-upload, please? Thank you!

Hope this helps, select the button and reach for click, then in the Click Method dropdown you can choose Precise Click