question

cihan-gs avatar image
cihan-gs asked

get lobby ?

How can a player connecting to a lobby created via playfab withdraw the lobby? The player connecting from the lobby needs the lobby to leave. I would appreciate it if you could give an example with code, I read the documentation but they are not very understandable to me.

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

You may refer to the code below to leave the lobby.

 //The lobby entity that the player created or joined, you can set it like this: LobbyEntity = PlayFabMultiplayer.CreateAndJoinLobby(...)...
 public Lobby LobbyEntity;
    
 //The authenticationcontext of the player who is currently logged in, you can set it in the login result
 PlayFabAuthenticationContext localuser;
    
 public void LeaveLobby()
 {
     PlayFabMultiplayer.OnLobbyLeaveCompleted += this.PlayFabMultiplayer_OnLobbyLeft;
    
     LobbyEntity.Leave(localuser);
 }
    
 private void PlayFabMultiplayer_OnLobbyLeft(Lobby lobby, PFEntityKey localUser)
 {
     Debug.Log(localuser.PlayFabId + " leave " + lobby.Id);
 }
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.