> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-zh/unity/sample-code.md).

# 示例代码

可以一目了然地查看 앱인토스 Unity SDK 提供的功能。点击各项即可查看详细指南和示例代码。

\[查看 Unity SDK GitHub ↗]\(<https://github.com/toss/apps-in-toss-unity-sdk/>)

### 开始指南

| 功能                                                         | 说明                      |
| ---------------------------------------------------------- | ----------------------- |
| [开始使用](/documentation/api-and-sdk-zh/unity/integration.md) | 可以安装 SDK 并继续进行到构建。      |
| API 使用模式                                                   | 可以查看异步处理、错误应对、测试环境设置方法。 |

### API 参考

| 功能        | 说明                                   |
| --------- | ------------------------------------ |
| 认证        | 用户可以使用 Toss 账号轻松登录，无需单独注册。           |
| 导航        | 可以设置屏幕顶部的标题·返回区域。                    |
| Safe Area | 确认屏幕边距值，避免被刘海·圆角遮挡。                  |
| 系统信息      | 可以查看设备 ID、平台、应用版本、网络状态等。             |
| 权限设置      | 可以请求并确认相机、位置等设备权限。                   |
| 位置信息      | 可以获取当前位置或实时追踪位置。                     |
| 媒体        | 可以用相机拍摄，或从相册导入照片。                    |
| 剪贴板       | 可以获取复制的文本，或将文本复制保存起来。                |
| 联系人       | 获取用户的联系人列表。                          |
| 存储        | 可以将用户信息保存到设备中。                       |
| 游戏排行榜     | 游戏结束后登记分数并显示排名。通过竞争元素让人想再玩一次。        |
| 分享        | 可以分享游戏结果或邀请链接，让接收者可直接在 Toss App 中打开。 |
| 其他 API    | 提供用户识别键、促销奖励、应用评价请求等功能说明。            |

### 构建

| 功能     | 说明                                   |
| ------ | ------------------------------------ |
| 构建配置文件 | 可以为开发·测试·发布各阶段配置优化后的构建设置。            |
| 构建流程   | 可以查看从初始化到 WebGL 构建、打包的整个过程。          |
| 构建自定义  | 可以通过 index.html、npm 包、Vite 插件等自定义构建。 |

### 屏幕与事件

| 功能      | 说明                                     |
| ------- | -------------------------------------- |
| 加载画面自定义 | 可以用自定义 HTML 和 JavaScript 按自己的方式装饰加载画面。 |
| 屏幕可见性处理 | 当应用切换到后台时，可以处理音频和游戏状态。                 |

### 分析与监控

| 功能        | 说明                                 |
| --------- | ---------------------------------- |
| SDK事件日志记录 | 记录用户在游戏中的操作。对数据分析、A/B 测试等游戏优化必不可少。 |
| Sentry 集成 | 可以接入 Sentry，自动追踪并监控错误。             |

### 变现

| 功能    | 说明                         |
| ----- | -------------------------- |
| 应用内广告 | 可以加入覆盖整个屏幕的广告，或观看后给予奖励的广告。 |
| 应用内支付 | 可以通过像道具一样一次性出售的商品来获得收益。    |

### 问题排查

| 功能      | 说明                                 |
| ------- | ---------------------------------- |
| 问题排查    | 可以查看使用 SDK 时常见的问题及解决方法。            |
| 调试与异常处理 | 可以查看在 Unity WebGL 环境中进行调试和处理异常的方法。 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-zh/unity/sample-code.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
