Upgrade 1.8 -> 2.0

Obsolete: MatchmakerClient

Starting from 2.0, the old MatchmakerClient cloud service has been marked as obsolete. Lobbies should be used for matchmaking instead.

Cloud Service Accessor Migration

Accessors for some cloud services were migrated from CloudService.GameServices directly to the root of CloudService.

Additionally, LobbiesService can now be accessed directly from the CloudService root as well, instead of being found under CloudService.Rooms.

This should help make your code shorter and make it easier to find all the different cloud services.

async void Start()
{
    PlayerAccount playerAccount = await PlayerAccount.GetMainAsync();

    //var lobbies = playerAccount.Services.Rooms.LobbyService; // <- old location
    var lobbies = playerAccount.Services.Lobbies;              // <- new location
    var lobbySessions = await lobbies.GetLobbySessionsAsync();
    Debug.Log($"You are currently in {lobbySessions.Count} lobbies.");

    //var cloudStorage = playerAccount.Services.GameServices.CloudStorage; // <- old location
    var cloudStorage = playerAccount.Services.CloudStorage;                // <- bew location
    var storageId = (playerAccount.Id.ToString(), "Friends");
    string[] friends = await cloudStorage.LoadObjectAsync<string[]>(storageId);
    Debug.Log($"Your have {friends.Length} friends: {string.Join(", ", friends)}");
}

Lobby Creation

Some changes were made to the Lobby creation process, to clearly distinguish between Lobbies that are associated with a particular Room, and Lobbies that are not associated with any Room (Lobbies for interroom communication).

For Room

The new CreateLobbyOptions.ForRoom method can be used to initialize new instances of lobby creation options that should be associated with a particular room:

async void Start()
{
    PlayerAccount playerAccount = await PlayerAccount.GetMainAsync();
    var rooms  = playerAccount.Services.Rooms;
    var lobbies = playerAccount.Services.Lobbies;
    var regionsInfo = await rooms.RefreshRegionsInfoAsync();
    var region = regionsInfo.Regions.First();
    var roomsService = rooms.GetRoomServiceForRegion(region);
    var room = await roomsService.CreateRoomAsync(new() { Name = "My Room" });

    var createLobbyOptions = CreateLobbyOptions.ForRoom(room);
    var lobbySession = await lobbies.CreateLobbyAsync(createLobbyOptions);

    Debug.Log($"You have created the lobby '{lobbySession.LobbyData.Name}'.");
}

Not For Room

To create a lobby that is not associated with any particular room, use the CreateLobbyOptions's constructor instead:

async void Start()
{
    PlayerAccount playerAccount = await PlayerAccount.GetMainAsync();
    var rooms  = playerAccount.Services.Rooms;
    var lobbies = playerAccount.Services.Lobbies;
    var regionsInfo = await rooms.RefreshRegionsInfoAsync();
    var region = regionsInfo.Regions.First();

    var createLobbyOptions = new CreateLobbyOptions(name: "My Lobby", region, maxPlayers: 25);
    var lobbySession = await lobbies.CreateLobbyAsync(createLobbyOptions);

    Debug.Log($"You have created the lobby '{lobbySession.LobbyData.Name}'.");
}

CreateLobbyOptions.Secret -> Password

The Secret property on the CreateLobbyOptions type has been marked as obsolete, and replaced by a Password property.

This was done to avoid potential confusion between a room secret and a lobby password, which are two separate things.

RefreshRegions -> RefreshRegionsInfo

The regions API now returns not only a list regions but also a list of ping servers for use with the new Ping Client. Following functions have been updated:

cloudRooms.Regions -> cloudRooms.RegionsInfo

cloudRooms.RefreshRegions -> cloudRooms.RefreshRegionsInfo

cloudRooms.RefreshRegionsAsync -> cloudRooms.RefreshRegionsInfoAsync

roomRegionsService.Regions -> roomRegionsService.RegionsInfo

roomRegionsService.FetchRegions -> roomRegionsService.FetchRegionsInfo

roomRegionsService.FetchRegionsAsync -> roomRegionsService.FetchRegionsInfoAsync

Last updated

Was this helpful?