Network Error force loads Entry map for client when server shuts down

This seems to have been an issue for some time now without being resolved.
If a listen server disconnects, the connected client in the session will get a Network Error event and is then loaded into Entry, regardless if that Network Error event is connected to a Open Level or console command (open mapname) these will be ignored and the client will end up on the Entry map.

I can’t find any way of fixing this and it is a problem. Any advice is appreciated!

Did you ever find a solution to this?

Not really, I did some hacky fix by setting a bool when the network error occurs, and if that bool is set when the entry map loads, it instantly loads the menu map, error messages etc. It works tho.

yeah, I actually did similar, not happy about it though. I have it that on network error, I quickly load the main menu (from the entry map Splash screen), and show an error message. Not so pretty.

guys, seems like this is the only solution, even if we don’t like it. i checked ShooterGame example, and they do the same, after disconnect they change GameState to ErrorMessage, and game opens default level, then this game state value is applied

While I’m sure there’s better ways, this seemed to do the trick for me.

void HandleNetworkFailure(UWorld* World, UNetDriver* NetDriver, ENetworkFailure::Type FailureType, const FString& ErrorString);

HandleNetworkFailure is found in the UnrealEngine.h file and can be overridden - this has other interesting stuff like OnTravelFailure.

void UMyGameInstance::HandleNetworkFailure(UWorld* World, UNetDriver* NetDriver, ENetworkFailure::Type FailureType, const FString& ErrorString) {
	if (FailureType == ENetworkFailure::FailureReceived || FailureType == ENetworkFailure::ConnectionLost) {
		APlayerController* PlayerController = GetFirstLocalPlayerController();
		if (!ensure(PlayerController != nullptr)) return;

		PlayerController->ClientTravel("/Game/Maps/MainMenu", ETravelType::TRAVEL_Absolute);
	}
}

The function can be implemented as shown above. Running multiple instances via commandline with log reveiled the FailureType to be FailureReceived and ConnectionLost so do a check - eventually it’ll be caught and you can do a client travel to the main menu.

	GetEngine()->OnNetworkFailure().AddUObject(this, &UMyGameInstance::HandleNetworkFailure);

Lastly, add a delegate with the function to the OnNetworkFailure event in the Init function of your GameInstance, or where you prefer, and it should be working.

I’ve also implemented your solution, but I still cannot control clientTraveling to the EntryMap. I don’t want the client to travel anywhere.
How do you choose whether/where the client will travel to post-NetworkError?

UGameMapsSettings::SetGameDefaultMap(levelName);