示例和插件
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Google Play 游戏电脑版的示例和插件演示了在 PC 环境中进行游戏认证和配置的 SDK 集成。
AGDKTunnel
AGDKTunnel 派生自 NDK 示例 Endless Tunnel。AGDKTunnel 演示了
以下 Google Play 游戏电脑版 SDK 集成:
- 适用于 Play 身份和云端存档的 Google Play 游戏服务
- Google Play 游戏电脑版的输入 SDK
为 Google Play 游戏电脑版启用 build
构建变体用于区分默认(移动)平台和 PC 平台。如需构建 AGDKTunnel 以便在 Google Play 游戏电脑版中运行,
请按以下步骤操作:
- 依次前往 Build > Select Build Variant,然后选择 playGamesPC build 变体。
- (可选)启用 Google Play 游戏服务,以便在移动设备和 PC 上开启云端存档。
- (可选)启用 Play Asset Delivery API 以传送 DXT1 压缩的纹理资源。
启用 Google Play 游戏服务
Google Play 游戏服务 (PGS) 用于用户登录和云端存档。
如需启用这些功能,请执行以下操作:
- 将 AGDKTunnel 软件包重命名为您选择的名称。
- 在 Google Play 管理中心内创建应用,然后按照相应步骤使用您的软件包名称设置 Google Play 游戏服务。
- 将
game_services_project_id
字符串值替换为
将 app/src/main/res/values/strings.xml
替换为您的项目 ID
Google Play 管理中心。
Trivial Kart
此示例游戏演示了如何在 Android 上使用 Unity 引擎来使用 Google Play 技术。对于 Google Play 游戏电脑版,游戏应演示以下内容:
如需了解配置信息,请参阅 trivialkart-unity 示例。
Google Play 游戏 Unity 插件
platform_utils_package
是一款自动执行日常安排的工具
适用于 Google Play 游戏电脑版该软件包包含以下功能:
- GPG 平台定义脚本:将 UNITY_ANDROID_x86_64 定义添加到 Player 设置中的自定义定义列表
- 资源导入器脚本:将每个导入的纹理设置为所选的纹理压缩(默认为 DXTC)
- 窗口选项:设置 Tools > GPG Settings 下提供的窗口选项
input-capture_package 演示了鼠标输入捕获功能:
- 带有空格键切换开关的鼠标输入捕获
- 鼠标按钮状态事件
- 鼠标滚动事件
- 屏幕几何图形检测
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Samples and plug-ins\n\nThe samples and plug-ins for Google Play Games on PC demonstrate the SDK integrations\nfor certification and configuration of games in the PC environment.\n\nAGDKTunnel\n----------\n\n[AGDKTunnel](https://github.com/android/games-samples/tree/main/agdk/agdktunnel)\nis derived from the NDK sample Endless Tunnel. AGDKTunnel demonstrates the\nfollowing Google Play Games on PC SDK integrations:\n\n- Google Play Games Services for Play identity and cloud save\n- Input SDK for Google Play Games on PC\n\n### Enable build for Google Play Games on PC\n\nBuild variants are used to differentiate between the default (mobile) platform\nand the PC platform. To build AGDKTunnel to run in Google Play Games on PC,\nfollow these steps:\n\n1. Go to **Build \\\u003e Select Build Variant** and select the **playGamesPC** build variant.\n2. (Optional) Enable **Google Play Games Services** to turn on cloud save on mobile and PC.\n3. (Optional) Enable **Play Asset Delivery API** to deliver DXT1 compressed texture assets.\n\n### Enable Google Play Games Services\n\nGoogle Play Games Services (PGS) is used for sign-in and cloud save.\nTo enable these features, do the following:\n\n1. Rename the AGDKTunnel package to a name of your choosing.\n2. Create an application on the Google Play Console and follow the steps to set up Google Play Games Services using your package name.\n3. Replace the `game_services_project_id` string value in `app/src/main/res/values/strings.xml` with the ID of your project in the Google Play Console.\n\nTrivial Kart\n------------\n\nA sample game demonstrating use of Google Play technologies on\nAndroid with the Unity engine.\nFor Google Play Games on PC, the game demonstrates:\n\n- [Google Play Games Services](/games/pgs/overview) for sign-in, achievements, leaderboards, friends, and cloud save\n- [Play Integrity](/google/play/integrity/overview) for receiving integrity signals about device integrity and Play license status\n- The Input SDK for Google Play Games on PC\n\nSee the [trivialkart-unity](https://github.com/android/games-samples/tree/main/trivialkart/trivialkart-unity) sample for configuration information.\n\nGoogle Play Games Unity plug-ins\n--------------------------------\n\n### Platform utils\n\nThe [platform_utils_package](https://github.com/android/games-samples/tree/main/googleplaygamesforpc/unity_projects/platform_utils_package)\nis a tool for automating routines\nfor Google Play Games on PC with Unity. The package includes the following features:\n\n- GPG platform define script: Adds a UNITY_ANDROID_x86_64 define to the list of custom defines within Player settings\n- Asset importer script: Sets every imported texture to a chosen texture compression (DXTC by default)\n- Window options: Sets window options available under **Tools \\\u003e GPG Settings**\n\n### Input capture\n\nThe [input-capture_package](https://github.com/android/games-samples/tree/main/googleplaygamesforpc/unity_projects/input_capture_package)\ndemonstrates mouse input capture features:\n\n- [Mouse input capture](/games/playgames/input-mouse#capture_mouse_input) with Spacebar toggle\n- Mouse button state events\n- Mouse scroll events\n- Screen geometry detection"]]