UMG - When opening a new level, old widgets do not get destroyed.

I tried this in an empty 4.4 project. If you use the ‘open mapname’ command then the old widgets will not be destroyed and this can cause some problems.

An easy way to illustrate this is to create a simpel textblock with opacity set at 0.1. Now keep opening new levels and you will notice that the opacity gets fuller and fuller because it keeps stacking that textblock on top of each other. I was doing some binding etc and this caused crashes for me I think.

Hello again, .

I tried to reproduce your issue on my end, and all I could get was a lousy crash! But it sounds like you’re getting crashes from this issue too, so I went ahead and reported the bug internally, and hopefully it’ll be fixed by next release. Thank you for helping us by trying out the experimental UMG.

Regards,

Jonathan

Good to hear, thank you!

We still have this issue… Any updates?

I thought that was the intentional behavior. It has worked like that since the day UMG was released from what I can recall.

It’s in the pipeline. I’ll post in this thread if I have any updates to give.

Very much appreciated, thank you.

While we’re waiting for a fix, I can perhaps share what I did to work around this issue.

When I create the widget using CreateWidget I bound the result in a variable.
At EndPlay I then called RemoveFromViewport() on the widget variable and made sure I had no lingering references lying around.

Hey undercover,

As it turns out, this is intended behavior. The reason is that there are circumstances where you would want your user interface to remain intact when you change levels. If you want the widgets to be destroyed when you switch levels, you’ll have to delete them yourself using code or blueprints.

This issue still remains in 4.6

How can we delete widgets via blueprints? I can’t seem to find anything like “Remove From Viewport” or even a destroy action for the widget.

Call Remove From Parent on the widget, that should destroy it.