您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
nathaniel.buck@unity3d.com 363b2f50 | 3 年前 | |
---|---|---|
.. | ||
Documentation~ | 4 年前 | |
Runtime | 3 年前 | |
CHANGELOG.md | 3 年前 | |
CHANGELOG.md.meta | 4 年前 | |
CONTRIBUTING.md | 3 年前 | |
CONTRIBUTING.md.meta | 4 年前 | |
LICENSE.md | 4 年前 | |
LICENSE.md.meta | 4 年前 | |
README.md | 4 年前 | |
README.md.meta | 4 年前 | |
Runtime.meta | 4 年前 | |
package.json | 3 年前 | |
package.json.meta | 4 年前 |
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
- Launch Unity
- Window > Package Manager
- 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}");
}