Game ideas & features

Your next feature

Player Profile

Display the player's avatar, frame and badges.

SDK developRequires a player session
Unity
Illustration of Player Profile
Your visible result

The selected avatar, frame or badge appears in the profile after loading it again.

Use player profiles2:37
Open video separately ↗

Prepare the same project

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

    Player Profile →
  2. Create or reuse these test entries in the dashboard form. These are example values, not current project data.

    Cosmetic ID
    avatar.zombie_07 (avatar), badge.supporter (badge)
    Locked (only players with an unlock can pick it)
    false

    Each entry is an ID that your game maps to its own art. Free entries can be picked by every player, locked entries only by players who own an unlock (from a gift code with grants or granted in the user management).

  3. Save, reload and verify the entries before running the example. Preserve unrelated definitions.

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.

This SDK example uses develop. Check whether the required APIs exist in your installed SDK.

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

C#
Assets/Scripts/PlayerProfileDemo.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 PlayerProfileDemo : 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: read the profile, then change avatar, frame and badges.
22 // Profile, unlocks and the cosmetics catalog of the signed in player
23 var profile = await PlayerProfileManager.Instance.GetProfile();
24 if (profile == null) { Debug.Log(PlayerProfileManager.Instance.LastErrorCode); return; }
25​
26 // Save avatar, frame and up to three badges (ids from your catalog in the dashboard)
27 var updated = await PlayerProfileManager.Instance.SetProfile(
28 "avatar.zombie_07", profile.profile.frameId, new[] { "badge.supporter" });
29 }
30}
Open the complete SDK sample ↗

Test your new feature.

The selected avatar, frame or badge appears in the profile after loading it again.

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

Endpoints
  • GET/player-profile
  • PUT/player-profile
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

Player ProfileUnity2:31
Open video separately ↗