// Create a new RoomCustomData object;RoomCustomData roomData =newRoomCustomData();// Set its name to "New Room"roomData.name="New Room";// Create two TeamCustomData objects// Assign them to team1 and team2 of the RoomCustomData objectroomData.team1=newTeamCustomData();roomData.team2=newTeamCustomData();// Assign local player to team1 by // adding local player's PlayerId to the players list of team1roomData.team1.players.Add(NetworkClient.Lobby.PlayerId);// create a new room with the RoomCustomData serializable objectNetworkClient.Lobby.CreateRoom(roomData,true,4, (successful, roomId, error) =>{if (successful) {Debug.Log("Room created "+ roomId); }else {Debug.Log("Failed to create room "+ error); }});
// Get rooms in the first page// Page row count is 5NetworkClient.Lobby.GetRooms(0,5, (successful, reply, error) =>{if (successful) { // loop through the rooms of the pageforeach(SWRoom room inreply.rooms) { // Deserialize room custom dataRoomCustomData roomData =room.GetCustomData < RoomCustomData > (); } }else {Debug.Log("Failed to get rooms "+ error); }});