question

martin-2 avatar image
martin-2 asked

PlayFab Lobby - How To Know If We've Been Kicked

Hello,

I am attempting to display user facing messages so that players know why the game has brought them to certain screens. I am attempting to display a message informing a user that they have been kicked from a lobby, but I am struggling to figure out how that player would know.

I am using the PlayFab Multiplayer Unity SDK. When a player is kicked from a lobby, the PlayFab.Multiplayer.PlayFabMultiplayer.OnLobbyDisconnected event is called. The only parameter we get from this event is a Lobby object. I am at a loss as how to determine why this event was called (was it due to losing connection, was it because we were kicked from the lobby, etc), and as such it is difficult to display an appropriate message explaining the issue to the user.

Any help would be appreciated,

Martin

unity3d
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

Currently, PlayFab Lobby doesn’t support providing info when a member is kicked. When you call Lobby.ForceRemoveMember - PlayFab | Microsoft Learn to kick off a member, the member removed will lose connection with lobby. But you can call PlayFabMultiplayer.JoinLobby - PlayFab | Microsoft Learn again to see if the player can rejoin the Lobby, if not and error is saying that “the member cannot rejoin the lobby because they have been banned”, then you will know the player is kicked. Because, usually when we kick off a player, we will set preventRejoin to true.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.