> 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) | ✓  |

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

### 账户要求

您需要拥有有效的 Convai 账户和 API 密钥，才能在本地开发期间将项目连接到 Convai。

1. 如果您还没有账户，请前往 [convai.com](https://convai.com) 创建一个。
2. 您可以在 Convai 控制面板的 **API 密钥** 部分获取 API 密钥。
3. 请至少在 Convai 控制面板中创建一个角色，并记下其 **角色 ID** ——场景设置时需要用到它。

您的 API 密钥存储在 `Assets/Resources/ConvaiSettings.asset`中。这属于 **API 密钥** 身份验证模式，适用于在 Unity Editor 中本地开发，而非用于分发的构建版本。完整的设置步骤请参阅 [配置 API 密钥](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started/configure-api-key.md) 。

如果您的项目将发布给测试人员或玩家，SDK 还支持 **身份验证令牌** 模式。该模式会为每次连接获取一个短期有效的凭据，而不是将账户 API 密钥打包到构建版本中。请先了解这两种模式并确定项目所需的模式，再进行场景设置。

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

### 后续步骤

确认环境满足上述所有要求后，即可安装 SDK。

{% content-ref url="/pages/f1f8700aca8f1ecef5696ae3f482c57ceae1064c" %}
[安装 Convai Unity SDK](https://docs.convai.com/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.
