Game ideas & features

Your next feature

Authentication

Sign in a test player and reuse their session.

Unity
Illustration of Authentication
Your visible result

A test player is signed in. Follow-up requests use their session.

Integrate player sign-in2:02
Open video separately ↗

Prepare the same project

  1. Choose the same project in the dashboard as in your game configuration.

    Authentication →
  2. No additional definition is needed for the first request. An empty result is valid until matching game data exists.

    This example signs in anonymously. Email, Google and Apple are alternatives with separate setup. Run only one sign-in method.

Build this feature

You can preview the guide. Running it requires an active project key. Prepare project

SDK installed and project configuration imported.

Save the C# file, attach it to a GameObject and enter Play. Check Console.

C#
Assets/Scripts/AuthenticationDemo.cs
horizOn callSetup
1using UnityEngine;
2using PM.horizOn.Cloud.Core;
3using PM.horizOn.Cloud.Manager;
4​
5// Attach this script to a GameObject in your first scene.
6public class AuthenticationDemo : MonoBehaviour
7{
8 async void Start()
9 {
10 // Setup: initialize and connect.
11 HorizonApp.Initialize();
12 await new HorizonServer().Connect();
13​
14 // horizOn: create a player account and sign in.
15 var auth = UserManager.Instance;
16 if (!auth.IsSignedIn)
17 {
18 bool signedIn = auth.HasCachedAnonymousToken()
19 ? await auth.RestoreAnonymousSession()
20 : await auth.SignUpAnonymous("TestPlayer");
21 if (!signedIn) { Debug.LogWarning("Sign-in failed"); return; }
22 }
23 Debug.Log($"Signed in as: {auth.CurrentUser.DisplayName}");
24 }
25}
Open the complete SDK sample ↗

Test your new feature.

A test player is signed in. Follow-up requests use their session.

Choose the same project in the dashboard as in your game configuration.

Endpoints
  • POST/user-management/signup
  • POST/user-management/signin
All endpoints in the API reference
Illustration of Leaderboards
Our suggestion for your next step

Give every round a high score.

Save the score after a round and show who's ahead. Keep using your connection and player session.

Tutorial video

Integrate player sign-inUnity5:09
Open video separately ↗