Remove from parent doesn't work

I made a simple Main Menu widget but when i click on “Play” it load the game but doesn’t remove the widget from viewport. I tried in many ways to fix this and noticed that if i remove “open level” everything works perfectly!

Im also having the same problem…

Have you been able to figure it out yet? I have been trying the whole day but im about to give up :frowning:

Hi, I just solved it on mine (again…) I think that the “Event Begin Play” is an endless loop of sorts or when you click on a level it is triggered again, thus giving the illusion of never leaving… try it out and let us know if that works for you :slight_smile:

Hello, i don`t understand how you solve it, what do you use instead of “Event Begin Play”?
Can you show,please

Hi Thierry, i dont remember how I fixed it. As im currently moving out of my apartment, I dont have my old files with me to check. If you can´t figure it out by yourself let me know in a week and ill look for the old files.

Out of the top of my head: Try placing the load level at the end of the string, after the widgets are destroyed. Make sure that the loading level loads a different widget or none at all.

Im not sure where those BPs are located but maybe you need to connect the ¨Menu_C Widget" as a target for the remove from parent node on the ¨OnClicked (play)¨ srting.

Hope some of these ideas help you while im moving into my new apartment.

Good luck,

Simply removing the load level function worked for me. Now I’ve still got to see if I can keep it from firing a gun while the menu is active. Plus, the pause menu only comes up once, I’m using this tutorial from the wiki.

I’m working from this tutorial.

Removing the load level function fixes it for me. I’m guessing the level automatically loads somewhere in the starter content. However, I would still fire when I pressed the mouse button, so I added these two to the Menu

1 Like

And I noticed the pause menu wasn’t coming back after I pressed and dismissed it once, so I connected the isValid pin to execute the connection to viewport again rather than creating a whole new widget as it was obviously firing as valid.

same issue!
Looks like docs are weird =\

I found a way for the map to start and not show the cursor on the map start, though if you want to have it start on a specific level, I keep running into issues. I would go on clicked > open level > remove parent > get player controller and set mouse show mouse cursor > get play controller and Set Input mode game only.

I had the same problem and noticed that I accidently mixed up the Event Begin Play graph for my level blueprint. After setting this in the MainMenu level instead of the game level it worked exactly like the example shows. Maybe this helps.

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.

This also explains why removing open level will fix the problem since removing it will stop loading a new level instance and thus a new instance UI.

Assalamu Aleykum, Hello, Nihao, Hola…!

Guys, if you followed some “PLUGIN” setup tutorials and changed default Player Controller to some other Controller it will not work (Remove from Parent). MY SOLUTION: Just create another Player Controller for the new level. If you can’t do correctly, search for YouTube “How to Create a Player Controller for new level”.

I hope this will be your Solution :slight_smile:

Thank you! That’s exactly how it works, I created the main menu widget in another map(created an empty level named “MainMenu” for example), and start game with this level opened, then open “FirstPersonExampleMap” by clicking “Play.” Problem resolved!

Maybe you have got higher than one HUD.
Try this