Get Room Custom Data

Overview

Gets the custom data of the local player's current room.
Methods
Called by players to begin an asynchronous operation to get the custom data of the local player's current room.
Class
The response object when the operation finished successfully.
The error that occurred when a lobby API operation failed.

Example

1
// Serializable classes for room custom data
2
[Serializable]
3
public class RoomCustomData {
4
public string name;
5
public TeamCustomData team1;
6
public TeamCustomData team2;
7
}
8
9
[Serializable]
10
public class TeamCustomData {
11
public List < string > players = new List < string > ();
12
}
Copied!
1
NetworkClient.Lobby.GetRoomCustomData((successful, reply, error) =>{
2
if (successful){
3
Debug.Log("Got room custom data " + reply);
4
// Deserialize room custom data
5
RoomCustomData roomCustomData = reply.GetCustomData<RoomCustomData>();
6
}
7
else{
8
Debug.Log("Failed to get room custom data " + error);
9
}
10
});
Copied!
Copy link