> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/unity-plugin-beta-overview/getting-started/installation/install-via-upm.md).

# 通过 UPM 安装

## 简介

通过 UPM 安装是推荐的方法，因为它便于维护、更新，并且能在团队中保持一致。

## 先决条件

* 在 Unity 编辑器中打开的 Unity 项目

## 分步骤

{% stepper %}
{% step %}
**打开 Package Manager**

在 Unity 中，前往 **窗口 → 包管理器**.
{% endstep %}

{% step %}
**从 Git URL 添加包**

* 点击 **+** 按钮（左上角）。
* 选择 **按名称安装包**
* 复制下面的包名称并将其粘贴到 Package Name 字段中。然后点击 **安装**.
  * `com.convai.convai-sdk-for-unity`

<figure><img src="/files/7eb68a69257e5aba74ba65e08c0942596ca18272" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**验证安装**

* 等待 Unity 完成导入和编译。
* 打开 **控制台** （如有需要）： **Ctrl + Shift + C** （Windows）/ **Cmd + Shift + C** （macOS）
* **预期结果：** 控制台中没有错误，并且 **Convai** 菜单会出现在顶部工具栏中。
  {% endstep %}
  {% endstepper %}

## 故障排查

* **安装后控制台错误**
  * 请确认你使用的是受支持的 Unity 版本。

## 结论

你已通过 UPM 安装了 Convai Unity SDK，并确认编辑器已成功编译。接下来，请前往 **设置 → 配置 API 密钥**.

{% hint style="info" %}
**需要帮助？** 如有疑问，请访问 [**Convai 开发者论坛**](https://forum.convai.com/).
{% 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:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/unity-plugin-beta-overview/getting-started/installation/install-via-upm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
