I’m working on a multiplayer game and I have players hosting and joining working fine, but I’m having trouble properly cleaning up the game session on the clients if the host leaves early. I found the ReturnToMainMenuHost/ClientReturnToMainMenu functions that look like they’re what I should be using to do this but ClientReturnToMainMenu doesn’t seem to get called.
Here’s my blueprint for when the host goes to the main menu:
17 months and 1 game later I figured out the solution to this. You need to inherit from UOnlineSession and put any cleanup code you need in the HandleDisconnect function. Make sure to call the base class’s HandleDisconnect so it can so its own cleanup. If you want to load a specific map that isn’t the game’s default you’ll want to call UGameplayStatics::OpenLevel after you call the base, otherwise GEngine::HandleDisconnect will overwrite the level you want to travel to.