> 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/setting-up-unity-plugin.md).

# 设置 Unity 插件

{% hint style="info" %}
该文件结构属于从文档中下载的插件 Core 版本。
{% endhint %}

### 设置 Unity 插件

在菜单栏中，进入 Convai > API Key Setup。

<figure><img src="/files/b2873a29e536094a78fd832ce0a9cc89096f1680" alt=""><figcaption></figcaption></figure>

前往 [convai.com](https://convai.com)，并登录你的 Convai 账户。登录后将重定向到仪表板。在仪表板中获取你的 API 密钥。

<figure><img src="/files/5c862aeb0bb8dd10d4bca78b973e632d99798151" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/5a7578736afe5218bdd02dfcffd47f832645ef26" alt=""><figcaption></figcaption></figure>

输入 API 密钥并点击开始。

<figure><img src="/files/5f807a48336088d93809bd4c1aaa2b79d2ab6b73" alt=""><figcaption></figcaption></figure>

这将在 resources 文件夹中创建一个 APIKey 资源。该资源包含你的 API 密钥。

通过进入 Convai > Demo > Scenes > Full Features 打开演示场景

<figure><img src="/files/df896fb936a711a7a8f19578ea130b406ddaf0b4" alt=""><figcaption></figcaption></figure>

点击 Convai NPC Amelia 并添加 Character ID（或者你可以保留默认的 Character ID）。你可以在此页面获取你的自定义角色的 Character ID [Broken mention](broken://pages/35a85ab8078743525dfb21372f6c08398990e426)。现在你可以与角色对话。该脚本已设置为你必须靠近角色，他们才能听到你。

<figure><img src="/files/ed8d3c340abc4fdb58bf34c961c7404106469659" alt=""><figcaption></figcaption></figure>

现在你可以测试 Convai 演示场景，并与其中的角色交谈。她叫 Amelia，热爱徒步旅行！

<figure><img src="/files/295034779d83e8b913914d94bf03893c75803866" alt=""><figcaption></figcaption></figure>

你可以打开 Convai NPC Script 来复制该脚本或在其基础上构建，以创建新的 NPC。

{% hint style="warning" %}
请尝试扩展 ConvaiNPC.cs 脚本，而不是直接修改它，以保持与其他脚本的兼容性
{% 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/setting-up-unity-plugin.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.
