Advanced Sessions - Session's "Current Players" value not decreasing when client leave session.

Hi,

I am currently working on a P2P multiplayer project in Unreal 5.1.

I have implemented the ability to join and leave sessions and am almost done with my game.

The only problem I run into is that the Blueprint Session Result object associated with a hosted session does not seem to decrement its “Current Players” integer variable whenever a client leaves the game.

image

This results in cases where in a 2 player lobby, once the second player leaves, is not able to be found when searching for sessions again (due to the session being full and thus not showing).

I am currently using this node for players to leave sessions:

image

Is there any way to directly manipulate the Blueprint Session Result object whenever a player leaves or am I missing something? I had assumed using “Destroy Session” would implicitly affect these variables since I had seen almost everyone simply using that.

Hi, as an update:

The issue is not with the Players Array (Player State array in the Game State) as I once thought, but rather with the FOnlineSession Struct still maintaining the Number of Public Connections variables:

It says it is read only, so no way for me to remove connections myself when a player leaves sadly.

Is there any way around this?

Could this be because I am testing it in PIE as Clients? Do I need to change this by any chance?

I’m thinking this since the game logs you in through Steam, so it could be establishing 2 connections when joining the same session. But, since they are both the same when doing the simulation it does not get rid of the exiting player’s connection since that is the same as the host’s?

Edit: I’d also like to add that this is actually in the OnlineSessionSettings.h file.