Get Room Custom Data

Overview

Gets the custom data of the local player's current room.

Methods

GetRoomCustomData(Action<bool, SWGetRoomCustomDataReply, SWLobbyError>)

Called by players to begin an asynchronous operation to get the custom data of the local player's current room.

Class

SWGetRoomCustomDataReply

The response object when the operation finished successfully.

SWLobbyError

The error that occurred when a lobby API operation failed.

Example

// Serializable classes for room custom data
[Serializable]
public class RoomCustomData {
public string name;
public TeamCustomData team1;
public TeamCustomData team2;
}
[Serializable]
public class TeamCustomData {
public List < string > players = new List < string > ();
}
NetworkClient.Lobby.GetRoomCustomData((successful, reply, error) =>{
if (successful){
Debug.Log("Got room custom data " + reply);
// Deserialize room custom data
RoomCustomData roomCustomData = reply.GetCustomData<RoomCustomData>();
}
else{
Debug.Log("Failed to get room custom data " + error);
}
});