UUserWidget across level change

I noticed that the shooter game example:
FShooterMessageMenu can persist across a level change, I think this is because it is a pure native slate widget.
In my game, I have used shooter game architecture as the foundation but have change the UI to use UMG.
I have a similar class to FShooterMessageMenu but it uses the UUserWidget

The problem I am having is that I display my user widget in game and then the level changes back to the menu (this happens the same in shooter game)
but when the level changes, user widgets get removed and destroyed:


I want to know if there is a way the UUserWidget can transition between levels without being automatically removed and destroyed?

Yes, and no. In 4.11, I’ve made it virtual so you can choose what happens to prevent auto collection. If your widget is not in the viewport it won’t be forcefully destroyed. It’s up to you to keep it alive otherwise, like having the game instance hold a reference to the UI. Keep in mind you need to be careful what you reference though your widget. If it’s holding onto references to Actors or other things that belong to the world going away, you’ll get the GC check crash people experience when the world can’t be cleaned up entirely.