Remove UMG Widget after Open Level

So I’ve been working on this menu for my Archviz presentations.

I’ve created a simple menu which works perfectly fine in the editor. But as soons as I package it and run it the Main menu stays on the screen when I open a new level.

This didn’t happen when I ran the game in the editor. So I’ve created a remove from viewport in the level blueprint that should get rid of the Widget. Unfortunately no succes. Maybe I’ve done something wrong.
So I’ve posted images of the blueprints so perhaps someone could shed a light on the matter.

Thanks,

Best Regards,

New level blueprint:

HUD Blueprint:

Main Menu Widget Blueprint:

Hello Silpher,

I have a quick suggestion before we delve too deep into this issue.

Quick Suggestion:

  1. Could you try only adding the Widget to the viewport via the level blueprint? You could then call the event to remove the widget from viewport (when changing levels) followed by opening of a new level. This way you could control when you wanted the Widget to show on the other levels by simply going into the individual level blueprints and adding the widget to the screen when you like.

The issue you are having is most likely due to a logic error. This is because the widget is set to show up on “Event begin play” this means every time a level is loaded the widget will be displayed because the blueprint you are using is in effect “traveling” with the player between levels and is resetting (beginning play) with each new level. I hope this helps.

Make it a great day

#Get All Widgets Of Class

You can use my Get All Widgets of Class BP Library node to guaranteed find and remove all instances of any widget class, and this will work after the new level has loaded or whenever you want!

No variable references to widgets need to be stored anywhere!

Enjoy!

Hi Rudy,

Thanks for the suggestion. It’s definitly a lot easier doing it on the level blueprint level. I’ve got a working menu now with load new map etc.

As an alternate workaround for this issue, which I was having myself:

If you are spawning your HUD in your HUD class for example, you can set an Event End Play in your HUD and make it remove your menu (which you would have previously stored as a variable). That will make sure it doesn’t duplicate the widgets when it loads a new map and reloads your HUD class.

I was having this problem because when running a 2 player game from the editor in Standalone mode, the game loads the default map once (and then my HUD spawns the menu), and then automatically tries to connect to the server, which then opens the map again because it’s loading the server’s map, duplicating the menus and losing the reference that my HUD had to the first menu.

you rock! Worked for me