Class PlayerAuthentication
Manage authentication in your scenes.
Inherited Members
Namespace: Unity.Services.Authentication.Components
Assembly: Unity.Services.Authentication.dll
Syntax
[AddComponentMenu("Services/Player Authentication")]
public class PlayerAuthentication : ServicesBehaviour
Fields
Events
Offers IAuthenticationService events as unity events.
Declaration
[Header("Events")]
[SerializeField]
public PlayerAuthenticationEvents Events
Field Value
| Type | Description |
|---|---|
| PlayerAuthenticationEvents |
FetchPlayerInfo
Fetches the player info upon sign in. This provides the player creation time, username, etc.
Declaration
[Header("On Sign In")]
[SerializeField]
[Tooltip("Fetches the player info upon sign in. This provides the player creation time, username, etc.")]
public bool FetchPlayerInfo
Field Value
| Type | Description |
|---|---|
| bool |
FetchPlayerName
Fetches the player name upon sign in.
Declaration
[SerializeField]
[Tooltip("Fetches the player name upon sign in.")]
public bool FetchPlayerName
Field Value
| Type | Description |
|---|---|
| bool |
GenerateName
Pass in the option to autogenerate the name if none exist. Only used if FetchPlayerName is true.
Declaration
[SerializeField]
[Visibility("FetchPlayerName", true)]
[Tooltip("Pass in the option to autogenerate the name if none exist.")]
public bool GenerateName
Field Value
| Type | Description |
|---|---|
| bool |
Profile
The profile value to use if SetCustomProfile is true. The profile is a local scope for persisted player credentials that you can use to get different players.
Declaration
[SerializeField]
[Visibility("SetCustomProfile", true)]
[Tooltip("The profile is a local scope for persisted player credentials that you can use to get different players.")]
public string Profile
Field Value
| Type | Description |
|---|---|
| string |
SetCustomProfile
Option to set a custom profile with SwitchProfile(string). The profile is a local scope for persisted player credentials that you can use to get different players.
Declaration
[Header("On Initialization")]
[SerializeField]
[Tooltip("Option to set a custom profile to scope persisted credentials and get different players.")]
public bool SetCustomProfile
Field Value
| Type | Description |
|---|---|
| bool |
SignInAnonymously
Sign in anonymously automatically after services initialization.
Declaration
[SerializeField]
[Tooltip("Option to sign in anonymously automatically after services initialization.")]
public bool SignInAnonymously
Field Value
| Type | Description |
|---|---|
| bool |
Properties
AuthenticationService
Access to the authentication service. Available after services are successfully initialized.
Declaration
public IAuthenticationService AuthenticationService { get; }
Property Value
| Type | Description |
|---|---|
| IAuthenticationService |
Methods
Cleanup()
Called on destroy to cleanup
Declaration
protected override void Cleanup()
Overrides
OnServicesInitialized()
Called when the services are initialized and ready to be used
Declaration
protected override void OnServicesInitialized()
Overrides
OnServicesReady()
Called when the services registry is set and ready to be used
Declaration
protected override void OnServicesReady()