Why won't UMG Widget close?

Hey guys!
Why won’t my UMG widget close even after it has been instructed to close after resetting the level? I’m gonna explain how this happens so here we go.

  1. I enter an area where there is a box trigger (Image 1).

  2. Upon colliding with the trigger a UMG Widget is created, added to the viewport, turns on the mouse cursor and then disables the players controller. (Image 2).

  3. UMG Widget appears on the screen. I press “Restart Level” and it restarts the level but the UMG Widget stays on the screen until I click “Restart Level” another 6-8 times. So overall I click “Restart Level” 6-8 times before it removes it from the screen. (Image 3).

  4. After being clicked, the button is to restart the level it is on (in this case level 5) and then remove it from the parent (viewport) but it does not do this. (Image 4).

Basically I want to know what the hell is wrong with it and how do I fix it?

Try to add this to your level bp

Hi

Duplicated what you had.

Works perfectly, so it is not that coding, something else must be doing it.

Can you try 2 things.

  1. break the open level, does the widget get removed from screen, just with remove from parent?

  2. try it this way around, should not make a difference, but can not hurt

Sometimes the sequence that things are being done in can impact what’s displayed or the result of what happens, where you click the buttons for opening the level make sure you remove the widgets first, because what will happen here is that your level is opening but your widgets are not removed yet, and depending on your settings they can be displayed when the new level opens if it’s set to carry them over. Because you are executing the command to open a level before the widgets are being removed from parent.

Remove the widgets before opening the levels.

You also might want to just create the widgets in your Begin Play event and simply change the visibility to show or hide them.

Hey dude.
Tried your way and sadly did not work. I tried Mhousse1247 way instead and works fine now. Thanks for answering :slight_smile:

Hey dude.
Works perfectly now. Thanks dude :slight_smile:

Thanks for suggestion dude. Ended up trying out Mhousse1247 way and it works fine now. Thanks for answering anyway, appreciate it :slight_smile:

Hello, I didn’t understand how this could work! I have the same problem but it’s not working