> 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/features/multi-character-sessions.md).

# 多角色会话

查找在一个 Unity 场景中运行多个 Convai 角色、选择玩家与谁交谈以及测试共享房间的指南。

多角色会话是一个 Unity 场景，其中有两个或更多 `ConvaiCharacter` 组件同时处于活动状态，并与 Convai 共享一个房间。玩家一次只与一个角色交互，SDK 会自动判断是哪一个——无需切换模式、无需添加组件，也无需填写字段。使用这些页面向一个可运行的场景添加第二个角色，了解房间如何决定当前被指向的是谁，并在多个角色共用同一房间时正确识别每个角色。

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>多角色会话如何工作</strong><br>了解房间如何围绕场景中的活动角色形成，以及它如何决定玩家正在与谁对话。</td><td><a href="/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions/how-multi-character-sessions-work.md">多角色会话工作原理</a></td></tr><tr><td><strong>构建你的第一个多角色会话</strong><br>向一个可运行的场景添加第二个角色，并确认房间会指向玩家所看的那个角色。</td><td><a href="/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions/quick-start.md">构建你的第一个多角色会话</a></td></tr><tr><td><strong>角色身份</strong><br>为房间中的每个角色分配各自的 Character ID，并了解当两个角色共用一个时会发生什么。</td><td><a href="/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions/character-identity.md">角色身份</a></td></tr><tr><td><strong>多角色示例</strong><br>导入随附的示例场景，查看多个角色、交互目标指向以及对话记录 UI 如何协同工作。</td><td><a href="/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions/multi-character-sample.md">多角色示例</a></td></tr></tbody></table>

### 多角色场景引出的两个问题

向场景中添加第二个角色会引出单角色场景不会涉及的两个问题：玩家正在和谁说话，以及玩家现在能否说话。每个问题都有其各自的功能区域。

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>对话目标定位</strong><br>SDK 如何决定玩家正在指向哪个角色，以及如何通过脚本或调整来优化这一决定。</td><td><a href="/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting.md">对话目标选择</a></td></tr><tr><td><strong>对话可用性</strong><br>被指向的角色是否已经能听到玩家，以及如何根据该状态控制你自己的 UI。</td><td><a href="/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability.md">对话可用性</a></td></tr></tbody></table>

### 下一步

从 [构建你的第一个多角色会话](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions/quick-start.md) 向场景中添加第二个角色并确认房间能覆盖到它，然后阅读 [角色身份](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions/character-identity.md) 在为多个角色分配 Character ID 之前。

{% content-ref url="/pages/1de47e20d64086de6ea2148c4871a665eec92182" %}
[多角色会话工作原理](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions/how-multi-character-sessions-work.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, and the optional `goal` query parameter:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
