Use anonymous sign-in
Implement anonymous sign-in to create new players without requiring any sign-in credentials or player input.
Read time 1 minuteLast updated 15 hours ago
Anonymous sign-in creates a new player for the game session without any input from the player. It's a quick way for a player to get started with your game.
If a session token is cached on the SDK, then the
SignInAnonymouslyAsync()
The following code sample shows how sign in to your game anonymously.
After implementing anonymous sign-in, it is recommended to integrate with at least one supported external identity provider to allow your players to continue their progress from another device or recover their account, if needed.async Task SignUpAnonymouslyAsync(){ try { await AuthenticationService.Instance.SignInAnonymouslyAsync(); Debug.Log("Sign in anonymously succeeded!"); // Shows how to get the playerID Debug.Log($"PlayerID: {AuthenticationService.Instance.PlayerId}"); } catch (AuthenticationException ex) { // Compare error code to AuthenticationErrorCodes // Notify the player with the proper error message Debug.LogException(ex); } catch (RequestFailedException ex) { // Compare error code to CommonErrorCodes // Notify the player with the proper error message Debug.LogException(ex); }}