Eventi nei giochi Unity
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questo argomento descrive come utilizzare gli eventi di Play Services per i giochi nei giochi Unity.
Prima di iniziare
Configura il progetto Unity e il plug-in Google Play Giochi per Unity. Per maggiori dettagli, consulta la Guida introduttiva.
Crea eventi
Puoi creare eventi in Google Play Console. Per maggiori dettagli, consulta la guida agli eventi per Play Services. Dopo aver creato gli eventi, aggiungi le relative risorse Android al plug-in come descritto nella guida introduttiva.
Registra gli eventi
Per incrementare un evento, chiama il seguente metodo:
using GooglePlayGames;
...
// Increments the event with Id "YOUR_EVENT_ID" by 1
PlayGamesPlatform.Instance.Events.IncrementEvent("YOUR_EVENT_ID", 1);
Dovrai effettuare questa chiamata una sola volta. Gestisce il raggruppamento e l'esecuzione in background.
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,["# Events in Unity games\n\nThis topics describes how to use Play Games Services events in Unity\ngames.\n\nBefore you get started\n----------------------\n\nSet up your Unity project and the Google Play Games plugin for Unity. For\ndetails, see the [Get started guide](/games/pgs/unity/unity-start).\n\nCreate events\n-------------\n\nYou create events in Google Play Console. For details, see the\n[events guide](/games/pgs/events#create-event) for Play Games Services. After\nyou create your events, add their Android resources to the plugin as described\nin the [get started guide](/games/pgs/unity/unity-start).\n\nRecord events\n-------------\n\nTo increment an event, call the following method: \n\n using GooglePlayGames;\n ...\n // Increments the event with Id \"YOUR_EVENT_ID\" by 1\n PlayGamesPlatform.Instance.Events.IncrementEvent(\"YOUR_EVENT_ID\", 1);\n\nYou only need to make this call once. It handles batching and execution in the\nbackground."]]