Remove from parent not working

so i click play on my main menu… the level loads in the background but the menu widget remains. any ideas?!
i have also tried not using open level but nothing alt text

Remove from viewport should come before opening of a level.

tried it and still nothing, i’ve been on this thread and it hasnt helped either

Make sure it is in the UMG blueprint.

i just created an empty level for main menu instead and its working perfectly now thanks

It’s very likely that it’s trapped in a loop. Let me explain with a diagram.

Let’s say you have Level_A, which has Game Mode_A and Level BP_A associated with it. Your code that generates the UI should reside in one of these two places.

When you click Play in Unreal Editor. An instance of Level_A is loaded into the game, let’s call it Level_A_1. And it triggers Game Mode_A and Level BP_A. As a result, an instance of UI_A is generated. Let it be UI_A_1.

At this point, you see UI_A_1 showing up on your screen. Behind it, the instance Level_A_1 is already running.

Now you click the play on this UI_A_1. It loads another instance of Level_A into the game, which is Level_A_2. When this instance is loaded, it again runs Game Mode_A and Level BP_A. Here comes the culprit. Another instance of UI_A is generated. This UI_A_2 is showing up on your screen. After that Remove From Parent is executed. But this command only gets rid of UI_A_1 because it is triggered by the clicking of the Play Button on UI_A_1.

UI_A_2 still exists making you think nothing happens. But it is actually not the same UI instance. When you click Play Button again, UI_A_2 gets cleared and here comes UI_A_3.

So to get rid of this loop, you have to put the code that generates the UI in a game mode or level bp associated with a level that is different from the level that is loaded from Play Button on the UI.