Statistiche sui giocatori nei giochi Unity
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
L'API Player Stats ti consente di personalizzare le esperienze di gioco in base a segmenti specifici
di giocatori e alle diverse fasi del ciclo di vita del giocatore. Puoi creare
esperienze personalizzate per ogni segmento di giocatori in base al loro
avanzamento, alla spesa e al coinvolgimento. Ad esempio, puoi utilizzare questa API per
intraprendere azioni proattive per incoraggiare un giocatore meno attivo a interagire nuovamente con
il tuo gioco, ad esempio mostrando e promuovendo nuovi elementi di gioco quando il
giocatore accede.
Il callback accetta due parametri:
1. Il codice risultato minore o uguale a zero indica la riuscita.
Per tutti i valori, consulta CommonStatusCodes.
1. L'oggetto PlayerStats
dal metodo
PlayGamesLocalUser.GetStats.
Per saperne di più, consulta la
guida alle statistiche dei giocatori.
Le statistiche sui giocatori sono disponibili dopo l'autenticazione:
((PlayGamesLocalUser)Social.localUser).GetStats((rc, stats) =>
{
// -1 means cached stats, 0 is success
// see CommonStatusCodes for all values.
if (rc <= 0 && stats.HasDaysSinceLastPlayed()) {
Debug.Log("It has been " + stats.DaysSinceLastPlayed + " days");
}
});
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-27 UTC.
[null,null,["Ultimo aggiornamento 2025-07-27 UTC."],[],[],null,["# Player statistics in Unity games\n\nThe Player Stats API let you tailor game experiences to specific segments\nof players and different stages of the player lifecycle. You can build\ntailored experiences for each player segment based on how players are\nprogressing, spending, and engaging. For example, you can use this API to\ntake proactive actions to encourage a less active player to re-engage with\nyour game, such as by displaying and promoting new in-game items when the\nplayer signs in.\n\nThe callback takes two parameters:\n1. The result code less than or equal to zero is success.\nSee [CommonStatusCodes](https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes) for all values.\n1. The [PlayerStats](/games/services/unity/v2/api/class/google-play-games/basic-api/player-stats)\nobject from the\n[PlayGamesLocalUser.GetStats](/games/services/unity/v2/api/class/google-play-games/play-games-local-user) method.\n\nFor more information see the\n[player stats guide](/games/services/android/stats).\n\nThe player stats are available after authenticating: \n\n ((PlayGamesLocalUser)Social.localUser).GetStats((rc, stats) =\u003e\n {\n // -1 means cached stats, 0 is success\n // see CommonStatusCodes for all values.\n if (rc \u003c= 0 && stats.HasDaysSinceLastPlayed()) {\n Debug.Log(\"It has been \" + stats.DaysSinceLastPlayed + \" days\");\n }\n });"]]