> 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/manual-integration.md).

# 手动接入

{% hint style="info" %}
**建议使用 Appintos Unity SDK**

直接集成方式需要手动实现 JS Bridge、WebGL 构建设置、打包等所有内容。如果没有特别理由的话 [Appintos Unity SDK](/documentation/api-and-sdk-zh/unity/integration.md)建议使用。
{% endhint %}

要将 Unity 游戏部署到 Appintos，需要将 Unity 项目 **WebGL**构建为 WebGL。本指南会介绍在 Unity 中创建 WebGL 构建的基本方法。

### 1. 安装 WebGL 模块

需要在 Unity Hub 中安装 WebGL 平台。

1. 启动 Unity Hub
2. 选择 Installs 选项卡
3. 点击所用 Unity 版本旁的三个点（···）→ Add Modules
4. 勾选 WebGL Build Support → 安装
5. 安装完成后，在 Unity 中进入 File > Build Settings 时，平台列表中会出现 **WebGL**。

### 2. 切换平台

1. 打开 Unity 项目
2. 进入 File > Build Settings
3. 选择 WebGL → 点击 Switch Platform

### 3. 调整 Player 设置

在 Edit > Project Settings > Player 菜单中设置以下项目。

* Publishing Settings
  * Compression Format: `Brotli` 设置为

### 4. 构建

1. 进入 File > Build Settings
2. 在选中 WebGL 的状态下 → 点击 Build
3. 指定输出文件夹（例如：Build/)

### 5. 确认结果

构建完成后通常 `index.html`, `Build`, `TemplateData` 会生成文件夹。根据 Unity 项目设置或版本不同，生成的文件夹可能会略有差异。可以将这些文件夹包含到 Vite 项目中，以网页形式展示。

使用 Vite 包装 Unity WebGL 的方法请参考 Vite 包装 Unity WebGL。

{% hint style="info" %}
**请参考**

在 Unity 6000.1.8 以下版本中，使用 2D 物理引擎(Rigidbody2D)时，在 WebGL 构建中 **GC 内存泄漏问题**存在。详情请参阅 [Unity Discussions 论坛](https://discussions.unity.com/t/memory-leak-when-using-rigidbody2d-physics-in-webgl/1649803)可在此处查看。
{% endhint %}


---

# 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/manual-integration.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.
