Game ideas & features

Your next feature

Users

Inspect your test player and their information.

Requires a player session
Unity
Illustration of Users
Your visible result

You can find the signed-in test player in the selected project.

User management overview1:45
Open video separately ↗

Prepare the same project

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

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

Build this feature

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

SDK installed, project configuration imported and player signed in.

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

C#
Assets/Scripts/UsersDemo.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 UsersDemo : MonoBehaviour
7{
8 async void Start()
9 {
10 // Setup: initialize, connect and sign in a player.
11 HorizonApp.Initialize();
12 await new HorizonServer().Connect();
13 if (!UserManager.Instance.IsSignedIn)
14 {
15 bool authenticated = UserManager.Instance.HasCachedAnonymousToken()
16 ? await UserManager.Instance.RestoreAnonymousSession()
17 : await UserManager.Instance.SignUpAnonymous("StatisticsPlayer");
18 if (!authenticated) return;
19 }
20​
21 // horizOn: check the saved session and change the display name.
22 // Check that the cached session is still valid (signs out when it is not)
23 bool valid = await UserManager.Instance.CheckAuth();
24 Debug.Log($"Session valid: {valid}");
25​
26 // Change the display name of the signed in player
27 bool renamed = await UserManager.Instance.ChangeName("PlayerOne");
28 }
29}
Open the complete SDK sample ↗

Test your new feature.

You can find the signed-in test player in the selected project.

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

Endpoints
  • POST/user-management/check-auth
  • POST/user-management/change-name
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.