หัวข้อนี้อธิบายวิธีใช้เหตุการณ์ของบริการเกมของ Play ในเกม Unity
ก่อนเริ่มต้นใช้งาน
ตั้งค่าโปรเจ็กต์ Unity และปลั๊กอิน Google Play Games สำหรับ Unity โปรดดูรายละเอียดที่คู่มือเริ่มต้นใช้งาน
สร้างกิจกรรม
คุณสร้างเหตุการณ์ใน Google Play Console โปรดดูรายละเอียดที่คู่มือเหตุการณ์สำหรับบริการ Play Games หลังจากสร้างเหตุการณ์แล้ว ให้เพิ่มทรัพยากร Android ของเหตุการณ์ลงในปลั๊กอินตามที่อธิบายไว้ในคู่มือเริ่มต้นใช้งาน
บันทึกเหตุการณ์
หากต้องการเพิ่มเหตุการณ์ ให้เรียกใช้เมธอดต่อไปนี้
usingGooglePlayGames;...// Increments the event with Id "YOUR_EVENT_ID" by 1PlayGamesPlatform.Instance.Events.IncrementEvent("YOUR_EVENT_ID",1);
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 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."]]