How to pass the mouse click through different widgets ( like hud and 3dwidget in scene )?

  • I have a hud menu , a widget component(Attached to the weapon actor).

  • Hud menu I use retainerbox(full screen)

  • I need to display 3d widget in the scene and click it

Bug:I can’t click it after the game is running

After testing I found that the hud menu is blocked the 3d widget.

Q : how can I change the rendering order of hud and 3d widget? so that i can click 3d widget in the scene.

The menu you see in the UMG Widget menu → Hierarchy is a display of which item will be connected to another item. In your case the Canvas Panel is your parent, and all of the other items are children. The most bottom widget in the Hierarchy is the one that shows on top of all other widgets.

I hope this helped! :slight_smile:

Thanks for the answer, but those are two unrelated widgets for different purposes, so I’m confused about how to change the rendering order :face_with_spiral_eyes:

Retainer visibility defaults to Visible, if you have a full screen retainer and you’ve yet to adjust the setting, the mouse click tests positive against it. You can either pass the input by returning Unhandled for the widget hosting the retainer. Or set the retainer to be Not Hit-Testable (and any other widget in the hierarchy that could be in the way).

Those 3:

image

Can consume your click by default before it gets to the component.

There can be no order for a world space widget comp and another widget living in screen space. They both live in different worlds, so to speak. The 2D UI will always have a go first.


There is also the ancient HUD class who can plop down old-school mouse hit boxes. Afair, it renders on top of UMG.

thank you so much :tada: :tada: :tada:, I don’t know the unhandled part, but I tried changing the visibility to not hit(self % all child) and it worked, the 3dwidget receive my mouse click!!

1 Like

Judging by what you’re up, you may end up needing it at some point. If a widget has an element that could intercept a click (or key), you can:

If you pass Unhandled, the click will go through. This gives you a chance to process input inside the widget and pass it along to whoever else needs it. Or arrest the process by passing Handled.

1 Like

Oh, I noticed this there a few days ago, but I couldn’t figure out how to use it so I ignored it. So this is how it is used, it’s amazing ! Thank you so much ! Hope everything goes your way. :grin: