Widget cursor capture bug?


So I think I’ve run into a bug with the experimental 3d widgets (in 4.7.5), and their visibility. The bug is that if a 3d widget has its visibility set to “Hit Test Invisible” or “Self Hit Test Invisible”, it still captures the cursors click.

A repro:

  1. Open up a blank 2D sidescroller blueprint project.

  2. Add a new player controller, tick the show mouse cursor, enable click events and enable mouse over events boxes, and set this controller class as the gamemode controller.

  3. Create a new widget, 100 x 100, with just a button filling up all the space, and have the button print a string when clicked.

  4. Create a new actor blueprint, add a widget component, set it to the class of widget we just made, set the pivot point to (0,0).

  5. Convert the ledge the player starts on to a blueprint and have it print a different string when clicked (make sure it blocks visibility in its collision settings).

  6. In the character BP, make a node for on F pressed, and have it spawn an instance of the BP with the widget on it, setting the transform so that is over the top of the ledge instance in the level (you’ll need to make sure the Y component of the location is at least 50 units towards the camera from the ledge or you’ll get different results).

  7. Set the visibility on the button to visible, and play. You’ll be able to click the button and it’ll print a string.

  8. Change the visibility of the button to “Hit Test Invisible” (the tooltip of which states that the cursor hit tests will never see this object) and try again. This time the button won’t print a string (correct), but the ledge which it is over does not print a string either - the cursor hit test has been blocked by something in between.

It could be this is intended behaviour, but I don’t think so given the tooltip. Either way, please let me know, and if anyone can think of a way to be able to click actors underneath 3D widgets, I would appreciate the help!

Hello ,

I will start off by saying I understand why you are getting the results that you are, but that this is working as intended. While you set the 2D widget aspects of the 3D widget to not respond to the mouse clicking it, you did not set the component to not interact with the mouse click. As an example, please try setting the widget component’s collision to “No Collision” This will allow you to click the ledge blueprint behind the button. The reason it was not working before is because you were still clicking on the 3D object itself. To get the what I believe is your desired effect you could simply change the collision of the 3D widget and just leave the button’s visibility set to visible. With this method you would set collision for the 3D widget to “UI” when you would like to click the button and then set it to “No Collision” when you would like to click behind the widget. I hope that this information helps.

Make it a great day

Thanks for that Rudy. I’m not sure that’ll work in my specific case since my 3D widget is actually just a blank canvas on which I arrange buttons, and I’d like the buttons to be pressable, while the canvas itself does not capture the mouse. Assuming I’m not overlooking something and I’d have to set the collision for the entire widget and not just for the buttons on that widget, I might have to re-engineer my system (unless you can think of another way!)

Thanks for your time though!