question

Phan Hùng Phong avatar image
Phan Hùng Phong asked

How to detect Disconnect Lobby when crash game

  • Hi Team,
    How to detect member leave party when crash game? I'm using PlayFabMultiPlayer SDK. I'm call "LeaveLobby" in OnApplicationQuit and OnDestroy but not success.

multiplayer
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

·
Xiao Zha avatar image
Xiao Zha answered

The OnApplicationQuit(called when quit the application) and OnDestroy(called when destroy game objects) method may not be called when a unity application crash, so, the “LeaveLobby” method will not be executed. Since we are not expert in Unity, you may consider consulting with Unity support to see if there has any specific unity method will be called when a unity application crash and call the “LeaveLobby” method. Also, the “Leave Lobby” method in PlayFabMultiPlayer SDK should be something like this: “LobbyEntity.Leave(localuser);”. You could refer to https://community.playfab.com/questions/144560/get-lobby.html to have more information.

In addition, since an event named PlayFabMultiplayer.OnLobbyUpdated (https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/lobby/unity-multiplayer-api-reference/playfab.multiplayer/playfabmultiplayer/onlobbyupdated) is raised when a lobby member disconnects, which can indicate which player's connection status has changed. You can then use the GetMemberConnectionStatus (https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/lobby/unity-multiplayer-api-reference/playfab.multiplayer/lobby/getmemberconnectionstatus) method to detect if the player is disconnected.

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.