How to remove a UMG menu created in Level A from a later loaded Level B?

Hi,

I have a UMG menu created in level A and add to viewport, then I open a new level B from level A, I want to remove the UMG menu after level B have loaded complete.

How to implement this?

Thanks!

There’s a “Remove From Viewport” node that does exactly that.

Thanks. I know how to remove it. But I mean remove it after level B loaded complete. Cause I can’t get the created UMG object from level B.

I’m not sure I understand what you mean. You want to only remove the widget after the level has completely loaded? I’m not trying to say you’re doing it wrong, but may I ask why you need that? I’m trying to think of a solution for you, but I need more information. Why can’t you simple call “remove from viewport” before “open level” in the same button binding (if you’re using a button for this)?

Ok. Cause the level B is a little big, need some time to load it. So my purpose is only include a UMG UI in level A(so it will load very fast) and use it as splash screen instead of get a black screen when I load level B.

I see, so you’re looking to create a sort of loading screen that goes away when the level is loaded. I too was looking for a game object that persisted across levels, and was unfortunately unable to find one. However, you can use the savegame blueprint as a sort of workaround - save the widget as a variable to the save game object, then load it when the new level is loaded and remove it from the viewport. It’s not a perfect solution - you shouldn’t have to create a savegame to keep variables in memory - but it does work. If you’re creating a savegame anyway, it’s not a bad deal. Just make sure the user knows the game requires a savegame to function.

Thanks. I’ll try it later.
Right now I have found another solution: use the UMG event tick to find a marker object in level B to test if level B is complete loaded, then I can remove the UMG, it’s not perfect.

If it works, it works. I don’t know if the widget would then persist in the level and would add to Tick overhead though, so it may or may not make a difference later in-game. But if not, that’s as good a solution as any.