Leave a lobby
Learn how players can leave a lobby and what happens when they exit.
Read time 1 minuteLast updated 15 hours ago
When players leave a lobby or get kicked out of the lobby, their player ID is removed from the players list. If the host leaves the lobby, another player in the lobby is randomly selected as the host. The host can also remove other players from the lobby. The same
RemovePlayerAsyncplayerIdwheretry{ //Ensure you sign-in before calling Authentication Instance //See IAuthenticationService interface string playerId = AuthenticationService.Instance.PlayerId; await LobbyService.Instance.RemovePlayerAsync(lobbyId, playerId);}catch (LobbyServiceException e){ Debug.Log(e);}
- is the ID of the lobby the player is trying to leave
lobbyId - is the ID of the player leaving the lobby
playerID