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 |
---|---|
IUnity |
Services
The custom instances of unity services.
Declaration
public static IReadOnlyDictionary<string, IUnityServices> Services { get; }
Property Value
Type | Description |
---|---|
IRead |
State
Initialization state.
Declaration
public static ServicesInitializationState State { get; }
Property Value
Type | Description |
---|---|
Services |
Methods
CreateServices()
Create a new services registry. Uses a Guid as identifier.
Declaration
public static IUnityServices CreateServices()
Returns
Type | Description |
---|---|
IUnity |
The services registry instance |
Exceptions
Type | Condition |
---|---|
Services |
Thrown when the services registry could not be created. |
CreateServices(string)
Create a new services registry.
Declaration
public static IUnityServices CreateServices(string servicesId)
Parameters
Type | Name | Description |
---|---|---|
string | servicesId | Unique identifier for the services registry. Defaults to a GUID. |
Returns
Type | Description |
---|---|
IUnity |
The services registry instance |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown when the services identifier is invalid. |
Services |
Thrown when the services registry could not be created. |
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 |
---|---|
Services |
Exception when there's an error during services initialization |
Unity |
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 |
---|---|---|
Initialization |
options | The options to customize services initialization. |
Returns
Type | Description |
---|---|
Task | Return a handle to the initialization operation. |
Exceptions
Type | Condition |
---|---|
Services |
Exception when there's an error during services initialization |
Unity |
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
Initialized
Invoked when initialization completes successfully.
Declaration
public static event Action Initialized
Event Type
Type | Description |
---|---|
Action |