> 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，并了解当两个角色共享同一个 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 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/features/multi-character-sessions.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.
