If you want a widget to only show in a small spot in unreal engine, this is how. When a player goes onto a certain spot, the widget will show, and when they leave, the widget will hide.

To do this, I am going to use actors. So, first thing to do is crate an actor in your unreal engine project. Right click on the content area, select blueprint class, and pick actor. You will also need a widget. Right click, hover over user interface, and pick widget. Open your widget, and do whatever you want in it. It is what is going to show when the player is in the spot that you want.

Go to your actor, and press the green add component button, and select box collision. Go to the event graph while you have your box selected, and search for add on actor begin overlap. From there, search for is valid. From the not valid, crate widget and select the one you made before, and then promote that to a variable, and add the variable to the viewport. Bring the variable you just made to the is valid node, and from is valid, go to the add to viewport node you just made. It should look like the picture below

After that, we now want to hide the widget when the use leaves the area where we want it to show. To do this, select your box collision in the top left corner again, and from there search for the add actor end overlap node. From there, get all widgets of class, and select your widget, then remove from parent, and plug the found widgets into the remove from parent node. That should look like the picture below.

That’s all! If you have any questions, leave a comment.

Leave a Reply to Admin Cancel reply

Your email address will not be published. Required fields are marked *