
灵活的数据格式
存档数据为纯字符串格式,你可以序列化任何结构——JSON、MessagePack 或自定义格式——不受 Schema 约束。
即时跨设备同步
玩家使用 horizOn 账号认证后,最新存档立即可在任何设备上获取。
提升玩家留存
当玩家知道自己的进度安全有保障时,换设备或重新安装后回归的可能性会大幅提升。
快速集成
Puzzle Quest
第 47 关
Progress73%
分数:128,450
游戏时长:12 小时 34 分钟
// Unity C#: Cloud Saves (needs a signed in player)
using PM.horizOn.Cloud.Manager;
using UnityEngine;
[System.Serializable]
public class PlayerSave { public int Level; public int Gold; public string Checkpoint; }
// Save: the object is stored as JSON
var save = new PlayerSave { Level = 42, Gold = 1500, Checkpoint = "world_3_boss" };
bool saved = await CloudSaveManager.Instance.SaveObject(save);
// Load it again, e.g. on another device (null when nothing is saved)
var loaded = await CloudSaveManager.Instance.LoadObject<PlayerSave>();
if (loaded != null) Debug.Log($"Loaded level: {loaded.Level}");# REST API: Cloud Saves (needs the player's session token)
# Save player data
curl -X POST https://horizon.pm/api/v1/app/cloud-save/save \
-H "X-API-Key: YOUR_API_KEY" \
-H "Authorization: Bearer SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"saveData":"{\"level\":42,\"gold\":1500,\"checkpoint\":\"world_3_boss\"}"}'
# Load player data
curl -X POST https://horizon.pm/api/v1/app/cloud-save/load \
-H "X-API-Key: YOUR_API_KEY" \
-H "Authorization: Bearer SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'这些示例使用 Unity SDK(C#)和 REST API。Godot 和 Unreal 在各自的 SDK 中有相同的调用: 参见快速入门
