Game ideas & features

Your next feature

Cloud Save

Save game progress and load it on the next launch.

Requires a player session
Unity
Illustration of Cloud Save
Your visible result

Saved progress loads again after restarting the game.

Inspect a cloud save1:56
Open video separately ↗

Prepare the same project

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

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

    Use a test player. This example replaces their save with level 5 and 1000 coins.

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/CloudSaveDemo.cs
horizOn callSetup
1using UnityEngine;
2using PM.horizOn.Cloud.Core;
3using PM.horizOn.Cloud.Manager;
4​
5// Define your save structure
6[System.Serializable]
7public class GameData
8{
9 public int Level;
10 public int Coins;
11}
12​
13// Attach this script to a GameObject in your first scene.
14public class CloudSaveDemo : MonoBehaviour
15{
16 async void Start()
17 {
18 // Setup: initialize, connect and sign in a player.
19 HorizonApp.Initialize();
20 await new HorizonServer().Connect();
21 if (!UserManager.Instance.IsSignedIn)
22 {
23 bool authenticated = UserManager.Instance.HasCachedAnonymousToken()
24 ? await UserManager.Instance.RestoreAnonymousSession()
25 : await UserManager.Instance.SignUpAnonymous("StatisticsPlayer");
26 if (!authenticated) return;
27 }
28​
29 // horizOn: save the player data and load it again.
30 var data = new GameData { Level = 5, Coins = 1000 };
31 bool saved = await CloudSaveManager.Instance.SaveObject(data);
32 if (!saved) { Debug.LogWarning("Cloud save failed"); return; }
33 var loaded = await CloudSaveManager.Instance.LoadObject<GameData>();
34 if (loaded == null) { Debug.LogWarning("Cloud load failed"); return; }
35 Debug.Log($"Loaded level={loaded.Level}, coins={loaded.Coins}");
36 }
37}
Open the complete SDK sample ↗

Test your new feature.

Saved progress loads again after restarting the game.

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

Endpoints
  • POST/cloud-save/save
  • POST/cloud-save/load
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

Cloud SaveUnity3:38
Open video separately ↗