UMG eats all of our double-click events

We have a UMG widget that covers the whole screen, but is mostly transparent and exists to house all the other widgets in our UI.

We also have an OnMouseDoubleClick() function that we register via

InputComponent->BindAction( "MouseDoubleClick", IE_DoubleClick, this, &APrototypeOCPlayerController::OnMouseDoubleClick );

and the appropriate line in the .ini file.

If we disable the UMG widget, we get the double-click events just fine. Similarly, if we set the outermost element in the UMG widget to be “Hidden,” we also get the double-click events.

However, if the widget is set to “Visible” or “Self Hit Test Invisible,” it eats all our double-click events, even the ones that are on transparent parts of the widget – and that’s a problem, because we need those double-clicks to be able to move the game camera properly. And unfortunately, it needs to be set to “Self Hit Test Invisible,” or the widget doesn’t really work otherwise …

This shouldn’t be classified as Legal & Licensing, right?

Errrm – nope, sorry, that must have been a mis-click. I meant to classify it under “C++ Programming.” Could you fix that?

Hello,

The issue that you are running into is because of the large widget that you have covering your screen. The widget is consuming all of your click events.

What you need to do is create a setup where you cast a line trace at your mouse position (convert screen location to world space) and check to see if the trace hits an object in your level that has an event that can be activated on a double click. If the trace hits and object that can be double-clicked, then you need to set the visibility of your widget to Hit Test Invisible. This will prevent it from absorbing click events while the trace is hitting an object that can respond to a double-click event. When the line trace is not hitting an object that can respond to double-click events, then set the widget back to Self Hit Test Invisible, or whatever visibility that you would like it to be normally in your game.