Destroying sessions of each client as the host?

Hi. I am trying to destroy sessions of each connected client when a host leaves the current game. I do not get any errors when the nodes are executed however the clients cannot seem to host/join a game afterwards. Here is how I’m trying to do it on button press from the widget:

ConnectedPlayers array gets filled on PostLogin event on every level’s gamemode. I do not see an error here but I’m still new to Multiplayer so I might be doing it wrong. I’d appreciate any tips! Have a great day.

OK I noticed this is a very simple question and I used a cave-man solution so I don’t know if its the best way to do it. So this code does not work however I just added Destroy Session on BeginPlay in the MainMenu level. Seems to fix the issue! :rofl:

What you would actually want to do is override the UOnlineSession::HandleDisconnect function. I’m not sure if you can do that in Blueprints though.

1 Like