Touch Input Doesn't Immediately Update Mouse Position in Custom Drag System (UE 5.4)

I’m developing a custom drag system in UMG for a VR/UI project in Unreal Engine 5.4.4. It works perfectly with mouse input, but I’m having issues when using touch input on a mobile device or touchscreen.

How My System Works (Mouse - Fully Functional)

  1. I have a main UI widget (WBP_GaleriaGeral) containing a ScrollBox with dynamically generated buttons (WBP_GaleriaIcon).
  2. When I press a button inside the ScrollBox, a new image widget (WBP_ImageDrag) is created at the mouse position and added to the viewport.
  3. Inside WBP_ImageDrag, there is a Tick event that updates the widget’s position to follow the mouse as long as a boolean (AllowDrag) is true.
  4. AllowDrag is set to true in Construct and on Mouse Button Down, and set to false on Mouse Button Up.

Problem with Touch Input

  • When I touch a button (WBP_GaleriaIcon) to create the image widget (WBP_ImageDrag), the first touch always uses the last known mouse position, not the actual touch position.
  • This means the first spawned WBP_ImageDrag appears in the wrong place, often far from the touch location.
  • I tried overriding On Touch Started and On Touch Ended to manually set AllowDrag = true/false, just like I do with the mouse, but the issue remains.
  • After the first touch, dragging works correctly, meaning that Unreal isn’t recognizing the new touch input as a position update immediately.

What I Tried (Without Success)

  1. Manually setting the mouse position to the touch position right before creating WBP_ImageDrag.
  2. Forcing a “mouse move” event when touch starts.
  3. Using “Convert Screen Location to World Space” to update the position before spawning WBP_ImageDrag.
  4. Calling “Set Input Mode Game and UI” when touch starts.
  5. Checking “Use Mouse for Touch” in Project Settings → Input.

What I Need Help With

  • How can I ensure that the first touch correctly updates the mouse position before spawning the widget?
  • Is there a way to force Unreal to recognize the touch location immediately upon pressing?
  • Am I missing a step to properly synchronize touch input and mouse position in UMG?

Thanks in advance for any help!

Hi, I encountered the same problem. The touch input is somehow doesn’t update mouse position immediately in widget bp. However, after some tinkering I found a workaround to resolve this problem. Inside the press button event, add some delay (I set 0.2s delay) before trying to get the mouse position. Using this workaround, the returned mouse position is at the touch location. Hope this helps.