Class UnityServices
Utility to initialize all Unity services from a single endpoint.
Inherited Members
Namespace: Unity.Services.Core
Assembly: Unity.Services.Core.dll
Syntax
public static class UnityServices
Properties
ExternalUserId
ExternalUserId. Use this property to pass a user ID from a 3rd party identity provider to Unity Gaming Services
Declaration
public static string ExternalUserId { get; set; }
Property Value
Type | Description |
---|---|
string |
Instance
The main runtime instance of unity services.
Declaration
public static IUnityServices Instance { get; set; }
Property Value
Type | Description |
---|---|
IUnityServices |
State
Initialization state.
Declaration
public static ServicesInitializationState State { get; }
Property Value
Type | Description |
---|---|
ServicesInitializationState |
Methods
CreateServices()
Create a new services registry.
Declaration
public static IUnityServices CreateServices()
Returns
Type | Description |
---|---|
IUnityServices | The services registry instance |
InitializeAsync()
Single entry point to initialize all used services.
Declaration
public static Task InitializeAsync()
Returns
Type | Description |
---|---|
Task | Return a handle to the initialization operation. |
Exceptions
Type | Condition |
---|---|
ServicesInitializationException | Exception when there's an error during services initialization |
UnityProjectNotLinkedException | Exception when the project is not linked to a cloud project id |
InitializeAsync(InitializationOptions)
Single entry point to initialize all used services.
Declaration
public static Task InitializeAsync(InitializationOptions options)
Parameters
Type | Name | Description |
---|---|---|
InitializationOptions | options | The options to customize services initialization. |
Returns
Type | Description |
---|---|
Task | Return a handle to the initialization operation. |
Exceptions
Type | Condition |
---|---|
ServicesInitializationException | Exception when there's an error during services initialization |
UnityProjectNotLinkedException | Exception when the project is not linked to a cloud project id |
Events
InitializeFailed
Invoked when initialization fails.
Declaration
public static event Action<Exception> InitializeFailed
Event Type
Type | Description |
---|---|
Action<Exception> |
Initialized
Invoked when initialization completes successfully.
Declaration
public static event Action Initialized
Event Type
Type | Description |
---|---|
Action |