UMG Widget Removed from Viewport on Server Travel

I have a Main menu widget that I hang from my UMyGameInstance subclass of UGameInstance in the attempt to get it to survive between map loads

It is a uproperty pointer to the main menu widget like this:



//UMyGameInstance
...
	UPROPERTY()
	UMainMenuWidget * MainMenuWidget;
...


I display the menu to the user like this:



void UMyGameInstance ::ShowMainMenu()
{
	if (MainMenuWidget == nullptr)
	{
		MainMenuWidget = CreateWidget<UMainMenuWidget>(this, MainMenuWidgetTemplate);
	}

	if (MainMenuWidget && MainMenuWidget->IsInViewport() == false)
	{
		MainMenuWidget->AddToViewport();

		APlayerController * const PlayerController = Cast<APlayerController>(GetFirstLocalPlayerController());

		if (PlayerController)
		{
			PlayerController->SetInputMode(FInputModeUIOnly().SetWidgetToFocus(MainMenuWidget->TakeWidget()));
			PlayerController->bShowMouseCursor = true;
		}
	}
}


When a player is playing they can open the main menu and select ‘Disconnect’ and it will load the main Entry.umap level

This unintentionally causes the viewport to remove the MainMenuWidget

I can call



MainMenuWidget->AddToViewport();


And it will return to the viewport, however, where the user was in the navigation of the menu is lost and it resets the menu to the default entry state.

So for example if the main menu had a server browser open and the user disconnected from the current game it would lose the state of the browser and force them to have to set the filters on the server browser again.

Anyone know how I can keep the state of the UMG menu around between map loads?

I think this has already been spotted as a bug, but im not 100% sure.

This is expected behavior between 2 level loading.
If you want to keep your widget, you must use “seamless travel” and not std travel.
Once you setup it, you can choose what actor/widget must stay during the travel / map loading.