> 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/convai-unity-sdk/getting-started/installation.md).

# 安装 Convai Unity SDK

Convai Unity SDK 可通过两种渠道获取。使用 **Package Manager** 适用于新项目，或者当您不希望管理 Asset Store 下载时——该包可直接从 Convai 注册表解析，无需手动下载。使用 **Asset Store** 如果您的项目已经从 Asset Store 库中获取包，或者您的工作室通过 My Assets 管理包版本。

这两种方法都会安装 SDK 版本 <code class="expression">space.vars.unity\_sdk\_version</code> 以及相同的三个必需依赖项。

{% tabs %}
{% tab title="Package Manager" %}
{% stepper %}
{% step %}

#### 打开 Package Manager

在 Unity 编辑器菜单栏中，选择 **窗口 > 包管理器**.

Package Manager 窗口会打开。继续之前，请确认您已连接到互联网。
{% endstep %}

{% step %}

#### 按名称添加包

点击 **+** 按钮，位于 Package Manager 窗口的左上角。选择 **按名称添加包** 从下拉菜单中。

会出现一个文本字段，提示输入包名称。
{% endstep %}

{% step %}

#### 输入包名称

在 Name 字段中输入或粘贴以下标识符，然后点击 **添加**:

```
com.convai.convai-sdk-for-unity
```

Unity 会联系注册表，解析包并开始下载。三个依赖项会自动安装：

| 包                                 | 版本     |
| --------------------------------- | ------ |
| `com.unity.nuget.newtonsoft-json` | 3.2.2  |
| `com.unity.ugui`                  | 2.0.0  |
| `com.unity.inputsystem`           | 1.18.0 |

在继续之前，请等待 Unity 编辑器右下角的进度条完成。
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
**依赖项冲突：** 如果您的项目已将 `com.unity.inputsystem` 或 `com.unity.ugui` 固定为较旧的版本，位于 `Packages/manifest.json`，安装将失败或产生版本不匹配。打开 `Packages/manifest.json`，移除或更新冲突的版本条目，然后重试。
{% endhint %}

{% hint style="success" %}
**安装完成** 当 Convai SDK for Unity 条目在 Package Manager 列表中显示绿色勾选标记且版本为 <code class="expression">space.vars.unity\_sdk\_version</code>。您还会看到一个新的 **Convai** 菜单项出现在 Unity 菜单栏中。
{% endhint %}
{% endtab %}

{% tab title="Asset Store" %}
{% stepper %}
{% step %}

#### 将 SDK 添加到您的 Asset Store 账户

打开 [Unity 资源商店](https://assetstore.unity.com/) 在浏览器中。搜索 **Convai SDK for Unity** 并打开该列表。点击 **添加到我的资源**，如有提示，请使用您的 Unity ID 登录。

按钮会变为 **在 Unity 中打开** 当该资源已添加到您的账户时。
{% endstep %}

{% step %}

#### 打开 Package Manager

在 Unity 编辑器菜单栏中，选择 **窗口 > 包管理器**.
{% endstep %}

{% step %}

#### 切换到我的资源

在 Package Manager 窗口中，点击左上角的包来源下拉菜单（它显示 **Packages: In Project** 或类似内容）并选择 **My Assets**.

您的 Asset Store 资源库会加载。找到 **Convai SDK for Unity** 在列表中。
{% endstep %}

{% step %}

#### 下载并导入

选择 **Convai SDK for Unity** 在列表中。点击 **下载**，然后点击 **导入** 在下载完成后。

Unity 会导入该包并自动安装三个依赖项：

| 包                                 | 版本     |
| --------------------------------- | ------ |
| `com.unity.nuget.newtonsoft-json` | 3.2.2  |
| `com.unity.ugui`                  | 2.0.0  |
| `com.unity.inputsystem`           | 1.18.0 |

在继续之前，请等待 Unity 编辑器右下角的进度条完成。
{% endstep %}
{% endstepper %}

{% hint style="info" %}
要将 SDK 更新到较新的版本，请返回到 **My Assets** 在 Package Manager 中，选择该 SDK，然后点击 **Update**.
{% endhint %}

{% hint style="success" %}
**安装完成** 当 Convai SDK for Unity 条目在 Package Manager 列表中显示版本为 <code class="expression">space.vars.unity\_sdk\_version</code>。您还会看到一个新的 **Convai** 菜单项出现在 Unity 菜单栏中。
{% endhint %}
{% endtab %}
{% endtabs %}

### 下一步

安装 SDK 后，通过输入您的 API 密钥将您的项目连接到 Convai。

{% content-ref url="/pages/3a95f57092cf5e9062d0377485e90f72b444fbd3" %}
[配置 API 密钥](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started/configure-api-key.md)
{% endcontent-ref %}


---

# 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/convai-unity-sdk/getting-started/installation.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.
