
Statistiche giocatore
Registra contatori e record personali di ogni giocatore.
SDK e REST
Integra Unity, Godot o Unreal oppure usa l’interfaccia REST.
Dashboard del progetto
Configura ogni funzionalità e gestisci i dati attuali nel tuo progetto.
Integrazione rapida
Statistiche giocatore
Video in arrivo
Registra round, eliminazioni e record in un lotto di sessione, con somma, massimo, minimo o ultimo valore.
using UnityEngine;
using PM.horizOn.Cloud.Manager;
using PM.horizOn.Cloud.Objects.Network.Requests;
var manager = StatisticsManager.Instance;
var snapshot = await manager.GetStatistics();
if (snapshot == null) { Debug.LogWarning(manager.LastErrorCode); return; }
string pendingKey = "horizOn_statistics_pending_" + snapshot.userId;
var pending = PlayerPrefs.HasKey(pendingKey)
? JsonUtility.FromJson<UpdateStatisticsRequest>(PlayerPrefs.GetString(pendingKey))
: new UpdateStatisticsRequest {
userId = snapshot.userId, operationId = manager.CreateOperationId(),
updates = new[] { new StatisticUpdate("kills", 3), new StatisticUpdate("best_score", 250) }
};
string originalJson = JsonUtility.ToJson(pending);
PlayerPrefs.SetString(pendingKey, originalJson);
PlayerPrefs.Save();
var result = await manager.UpdateStatistics(pending.updates, pending.operationId);
if (result == null) {
// Keep the saved ID and batch. Reconcile OPERATION_EXPIRED before a new logical report.
Debug.LogWarning(manager.LastErrorCode);
return;
}
// A late success for O1 must never acknowledge a newer pending O2.
if (PlayerPrefs.GetString(pendingKey, null) == originalJson) {
PlayerPrefs.DeleteKey(pendingKey);
PlayerPrefs.Save();
}
foreach (var counter in result.values) Debug.Log(counter.key + "=" + counter.value);Questi esempi usano l'SDK per Unity (C#) e la REST API. Godot e Unreal hanno le stesse chiamate nei loro SDK: vedi la quickstart
Domande frequenti
Pronto per l'integrazione?
Inizi a costruire con horizOn oggi stesso. Tier gratuito incluso.
