Unity ゲームのイベント
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このトピックでは、Unity ゲームで Play ゲームサービス イベントを使用する方法について説明します。
開始する前に
Unity プロジェクトと Unity 用の Google Play Games プラグインをセットアップします。詳細については、スタートガイドをご覧ください。
イベントを作成する
Google Play Console でイベントを作成します。詳細については、Play ゲームサービスのイベントガイドをご覧ください。イベントを作成したら、スタートガイドの説明に沿って Android リソースをプラグインに追加してください。
イベントを記録する
イベントをインクリメントするには、次のメソッドを呼び出します。
using GooglePlayGames;
...
// Increments the event with Id "YOUR_EVENT_ID" by 1
PlayGamesPlatform.Instance.Events.IncrementEvent("YOUR_EVENT_ID", 1);
この呼び出しは 1 回のみ行う必要があります。バッチ処理と実行はバックグラウンドで処理されます。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[null,null,["最終更新日 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."]]