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

// 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);
    }
});

Last updated