Hi!
Ok I know this is probably an easy one but I’m at a loss, I’ve spent the last hour searching for a way to retrieve other player’s ids as a host. I need them so that I can kick players from the lobby as a host. Where can I get them from? Thank you in advance…
You can use the following code to do this:
// Get the lobby
var lobby = await LobbyService.Instance.GetLobbyAsync("lobbyID");
// Get a player
var player = lobby.Players[0];
// Remove the player
await LobbyService.Instance.RemovePlayerAsync("lobbyID", player.id);
Not every method (best example is the GetLobbyAsync(string lobbyId) method) is documented, which is very annoying. Best guess is to always take a look at the service class and its method. You can find more information there when reading the source code.
2 Likes
Could you point out where you were looking before? We can try to make that documentation easier to find.
For reference, you can find the high-level GetLobbyAsync documentation here. From there, you could look at the Lobby model and Player model documentation in order to see that the player IDs will be returned there. It also might have been easier to just use our API documentation in this case.
My bad, I didn’t look at the interfaces all the way down below, I was looking at LobbyService and not ILobbyService.
1 Like