Join Room

Overview

Joins the private/public rooms of your game in the Lobby server.

Methods

JoinRoom(string, Action<bool, SWJoinRoomReply, SWLobbyError>)

Called by players to begin an asynchronous operation to join a room in the Lobby server using the specified roomId. This method allows players to join both private and public rooms.

JoinRoomRandomly(Action<bool, SWJoinRoomReply, SWLobbyError>)

Called by players to begin an asynchronous operation to randomly join a room in the Lobby server. This method allows players to join public rooms.

JoinOrCreateRoom(bool, int, int, Action<bool, SWJoinRoomReply, SWLobbyError>)

Called by players to begin an asynchronous operation to randomly join a room in the Lobby server. If no available rooms were found, The player will create a new room with the specified wantRT, playerLimit, and player TTL. This method allows players to join public rooms.

Class

SWJoinRoomReply

The response object when the operation finished successfully.

SWLobbyError

The error that occurred when a lobby API operation failed.

Example

NetworkClient.Lobby.JoinRoom(roomId, (successful, reply, error) =>{
if (successful) {
Debug.Log("Joined room " + reply);
}
else {
Debug.Log("Failed to Join room " + error);
}
});
NetworkClient.Lobby.JoinRoomRandomly((successful, reply, error) =>{
if (successful) {
Debug.Log("Joined room randomly " + reply);
}
else {
Debug.Log("Failed to Join room randomly" + error);
}
});
NetworkClient.Lobby.JoinOrCreateRoom(true, 4, 60, (successful, reply, error) =>{
if (successful){
Debug.Log("Joined or created room " + reply);
}
else{
Debug.Log("Failed to join or create room " + error);
}
});