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

# 导入并运行示例场景

导入捆绑的示例场景，并在构建自己的场景之前验证 SDK 是否已正确安装并连接。

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

| 示例             | 说明                                                       |
| -------------- | -------------------------------------------------------- |
| **基础示例**       | 核心设置和交互流程，使用 `Convai_Char_Robot`，一个非人形角色                 |
| **LipSync 示例** | 高质量角色 `Sofia` ，带有实时口型同步，以及一个调试中心，用于在播放模式下检查情绪、动态上下文和视觉状态 |
| **多角色示例**      | 一个共享房间示例，演示多个 Convai 角色、交互目标、转录 UI 和运行时成员列表变化            |

查找示例的步骤会因你安装 SDK 的方式而有所不同。

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

#### 打开 Package Manager

在 Unity 编辑器中，打开 **Window > Package Manager**。在左上角的下拉菜单中，选择 **In Project**中粘贴你的密钥，然后选择 **Unity 版 Convai SDK** 。
{% endstep %}

{% step %}

#### 导入示例

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

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

{% step %}

#### 打开场景

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

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

#### 查找示例

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

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

其中有三个文件夹： `BasicSample`, `LipSyncSample`，以及 `MultiCharacterSample`.
{% endstep %}

{% step %}

#### 打开场景

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

场景打开后：

{% stepper %}
{% step %}

#### 进入播放模式

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

* `[ConvaiRuntime] Started successfully` — SDK 已初始化所有内部服务
* `[RoomConnectionRuntimeAdapter] Room connection succeeded (mode=create).` — 连接到 Convai 的房间

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

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

在 LipSync 示例中， **示例调试中心** 面板已经在场景中。点击游戏视图中的 Emotion、Context 或 Vision 按钮，以打开一个抽屉，在角色说话时显示实时状态。

### 示例渲染管线说明

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

### 下一步

既然你已经确认 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 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/import-and-run-sample-scenes.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.
