Server Travel doesn't remove existing Viewport Widgets?

Clients in our game have a simple widget that just displays “Waiting For Server” when they’re waiting in the lobby.

When the Clients are pulled into the next map via ‘Server Travel’, the widget is left on screen over everything else. There’s no clean method of removing it, so we’ve had to add a “Get All Widgets Of Class” and “Remove From Viewport” to EVERY level, in their respective level blueprints.

This seems like a bug, especially considering that on server travel the widgets owning Player Controller is destroyed in the process, resulting in a null pointer reference somewhere and the potential for a crash. Surely there is a cleaner method of clearing the viewport for a client when they are travelled to the next map?

I can confirm this in Unreal 4.7

Can confirm this six years later…

Hi, what I do is to keep track of all the created widgets on a custom player controller via variable references. I also override the EndPlay method of player controller, in that method I call the removeFromParent method on each widget reference. I only keep track and remove the references if it is a local controller, as UI widgets should only exist on owning-client player controller replica.

2 Likes