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

# 前提条件

在开始安装前，确认 Convai Unity SDK 所需的 Unity 版本、包依赖项和 Convai 账户。

在安装 Convai Unity SDK 之前，请确认你的环境满足以下要求。遗漏其中任何一项都可能导致安装错误或运行时故障，而这些问题在事后更难诊断。

### 系统要求

| 要求       | 最低要求                                                           |
| -------- | -------------------------------------------------------------- |
| Unity 版本 | <code class="expression">space.vars.unity\_min\_version</code> |
| 脚本后端     | Mono 或 IL2CPP                                                  |
| 互联网连接    | 在编辑器阶段和运行时都需要                                                  |

{% hint style="warning" %}
Unity <code class="expression">space.vars.unity\_min\_version</code> 是硬性下限——在更早的版本上没有受支持的配置，包括 Unity 2022 或 Unity 2023 等较旧的 LTS 版本。如果你的项目目标是更旧的版本，请先将项目升级到 Unity 6，再安装 SDK。没有任何变通方法。
{% endhint %}

### 所需的 Unity 包

该 SDK 依赖四个 Unity 包。两种安装方式（Package Manager 和 Asset Store）都会自动安装这些包——除非你遇到版本冲突，否则无需手动添加。

| 包                                 | 最低版本                                                                      |
| --------------------------------- | ------------------------------------------------------------------------- |
| `com.unity.ai.inference`          | <code class="expression">space.vars.dep\_ai\_inference\_version</code>    |
| `com.unity.nuget.newtonsoft-json` | <code class="expression">space.vars.dep\_newtonsoft\_json\_version</code> |
| `com.unity.ugui`                  | <code class="expression">space.vars.dep\_ugui\_version</code>             |
| `com.unity.inputsystem`           | <code class="expression">space.vars.dep\_inputsystem\_version</code>      |

如果你的项目已经将这些包中的任何一个固定到较旧版本 `Packages/manifest.json`，自动安装会静默失败或产生版本冲突。请在安装 SDK 之前移除或更新现有的版本锁定。

### 受支持的渲染管线

| 渲染管线         | 受支持 |
| ------------ | --- |
| 内置渲染管线       | ✓   |
| 通用渲染管线（URP）  | ✓   |
| 高清渲染管线（HDRP） | ✓   |

有关详细的平台和渲染管线兼容性，请参阅 [兼容性与要求](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/compatibility-and-requirements.md).

### 账户要求

在本地开发期间，要将你的项目连接到 Convai，你需要一个有效的 Convai 账户和 API 密钥。

1. 在以下位置创建账户： [convai.com](https://convai.com) 如果你还没有账户。
2. 请从 **API 密钥** Convai 仪表板中的该部分获取。
3. 在 Convai 仪表板中至少创建一个角色，并记下其 **角色 ID** ——你在场景设置时需要它。

你的 API 密钥存储在 `Assets/Resources/ConvaiSettings.asset`。这是 **API 密钥** 身份验证模式，适用于在 Unity 编辑器中进行本地开发，而不是用于你分发的构建版本。请参阅 [配置 API 密钥](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started/configure-api-key.md) 以获取完整的设置步骤。

如果你的项目会发布给测试人员或玩家，SDK 还支持 **身份验证令牌** 模式，它会为每个连接解析一个短期凭据，而不是在构建中随项目一起发布你的账户 API 密钥。在进入场景设置之前，请先查看这两种模式并决定你的项目需要哪一种。

{% content-ref url="/pages/5c8198db09e24a6ea14c4fe27e4c76651e64ccca" %}
[身份验证](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/authentication.md)
{% endcontent-ref %}

### 下一步

当你的环境满足上述所有要求后，请安装 SDK。

{% content-ref url="/pages/f1f8700aca8f1ecef5696ae3f482c57ceae1064c" %}
[安装 Convai Unity SDK](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started/installation.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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started/prerequisites.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
