您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
Jacob Stove Lorentzen a5ac6a0d Adding new Packages 3 年前
..
Documentation~ Branch with Beta packages included. 3 年前
Runtime Adding new Packages 3 年前
Samples~ Adding new Packages 3 年前
CHANGELOG.md Package update and library source changes. 3 年前
CHANGELOG.md.meta Added LocalPackage for latest Lobby Package 3 年前
LICENSE.md Added LocalPackage for latest Lobby Package 3 年前
LICENSE.md.meta Added LocalPackage for latest Lobby Package 3 年前
README.md Branch with Beta packages included. 3 年前
README.md.meta Added LocalPackage for latest Lobby Package 3 年前
Runtime.meta Added LocalPackage for latest Lobby Package 3 年前
Third Party Notices.md Package update and library source changes. 3 年前
Third Party Notices.md.meta Package update and library source changes. 3 年前
package.json Package update and library source changes. 3 年前
package.json.meta Added LocalPackage for latest Lobby Package 3 年前

README.md

Unity Lobby Beta

This is the Unity SDK for the Unity Lobby Beta. See the Lobby Dashboard for more information.

Installing Unity Lobby

  1. Launch Unity
  2. Window > Package Manager
  3. In the Package Manager Click on the "+" sign in the top left corner then select "Add Package From Disk" then browse to com.unity.services.lobby and select package.json > open

Unity Authentication Requirement

The Unity Lobby service requires using the Unity authentication package. To use it, install the com.unity.services.authentication package. In the Beta, this is provided in the Lobby-Relay SDK download.

Using Unity Authentication

To use authentication, you will need to import the package:

using Unity.Services.Authentication;

Once imported, you will need to log in before using API calls.

Sample Usage:

async void Start()
{
    // Anonymous Sign-In
    await UnityServices.Initialize();
    await AuthenticationService.Instance.SignInAnonymouslyAsync();

    if (AuthenticationService.Instance.IsSignedIn)
    {
        // Query for Lobbies
        await QuickJoinConquestLobby();
    }
    else
    {
        Debug.Log("Player was not signed in successfully?");
    }

}

async void QuickJoinConquestLobby()
{
    // Try to quickJoin a Conquest game
    QuickJoinRequest request = new QuickJoinRequest(){
        Filter = new List<QueryFilter>(){ 
            new QueryFilter(
                field: QueryFilter.FieldOptions.S1,
                op: QueryFilter.OpOptions.EQ,
                value: "Conquest")
        }
    };

    Response<Lobby> response = await LobbyService.LobbyApiClient.QuickJoinLobbyAsync(request);
    Debug.Log($"Joined lobby {response.Result.Id}");
}