> 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/import-and-run-sample-scenes.md).

# 导入并运行示例场景

Convai 面向 Unity 的 SDK 附带两个示例场景。在开始构建自己的场景之前，运行其中一个是确认安装、API 密钥和音频设置是否正常工作的最快方法。

| 示例         | 说明             |
| ---------- | -------------- |
| **基础示例**   | 与机器人角色的基础对话    |
| **唇形同步示例** | 具有实时唇形同步的高质量角色 |

查找这些示例的步骤因你安装 SDK 的方式而异。

{% tabs %}
{% tab title="包管理器" %}
{% stepper %}
{% step %}

#### 打开包管理器

在 Unity 编辑器中，打开 **窗口 > 包管理器**。在左上角下拉菜单中，选择 **项目内**，然后选择 **适用于 Unity 的 Convai SDK** 从列表中。
{% endstep %}

{% step %}

#### 导入示例

在右侧详细信息面板中，点击 **示例** 选项卡。点击 **导入** 要运行的示例旁边的。

Unity 会将示例资源复制到 `Assets/Samples/Convai SDK for Unity/<version>/`。一个新文件夹会出现在 `Assets/Samples/` 下方，位于项目窗口中。
{% endstep %}

{% step %}

#### 打开场景

在项目窗口中，导航到已导入的示例文件夹并打开其中的 `.unity` 场景文件。
{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="资源商店" %}
{% stepper %}
{% step %}

#### 查找这些示例

通过资源商店安装时，所有示例场景都会自动导入到你的项目中。在项目窗口中，导航到：

```
Assets/Convai SDK For Unity/Samples/
```

其中有两个文件夹： `BasicSample` 是位于 `LipSyncSample`.
{% endstep %}

{% step %}

#### 打开场景

打开 `.unity` 你想运行的示例文件夹中的场景文件。
{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

场景打开后：

{% stepper %}
{% step %}

#### 进入播放模式

按 **播放**。随着 SDK 初始化，Unity 控制台会记录以下几行内容：

* `[ConvaiRuntime] 启动成功` — SDK 已初始化所有内部服务
* `[RoomConnectionRuntimeAdapter] Character <character-id> 连接成功（模式=create）。` — 角色已连接到 Convai

对着麦克风说话。角色会以语音和文本输出进行回应。

如果没有出现响应且控制台显示警告，请检查 [验证你的设置](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started/validate-your-setup.md) 以获取诊断清单。
{% endstep %}
{% endstepper %}

### 示例渲染管线说明

示例场景是使用通用渲染管线（URP）构建的。如果你的项目使用不同的渲染管线，导入后材质可能会显示为粉色。使用 **编辑 > 渲染 > 材质**将材质转换为与你当前活动的渲染管线相匹配，然后选择适合你的管线的转换选项。

### 下一步

现在你已经确认 SDK 正常工作，在构建自己的设置之前，先了解每个场景组件的作用。

{% content-ref url="/pages/e9f6a66a2fa7574cb77509cf3bffb7e711540c85" %}
[场景组件参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started/scene-components.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/import-and-run-sample-scenes.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.
