> 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/conversation-targeting.md).

# 对话目标选择

查找用于选择目标模式、调优模式，以及在 Convai Unity SDK 房间中编写脚本指定玩家正在对哪个角色说话的指南。

当房间中有多个角色时，对话目标选择功能会帮助 Convai Unity SDK 判断玩家正在与哪个角色交谈。 `ConvaiManager` 会持续重新评估目标，并将对话切换到玩家正在对话的角色，无需添加组件或填写字段。

<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="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/how-conversation-targeting-works.md">对话目标选择如何运作</a></td></tr><tr><td><strong>选择目标选择模式</strong><br>根据摄像机和控制方案，在“注视”、“距离优先”和“手动”模式之间进行选择。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/choose-a-targeting-mode.md">选择目标模式</a></td></tr><tr><td><strong>调整对话目标选择</strong><br>调整范围、注视角度、切换余量和切换延迟，以适应场景。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/tune-targeting.md">调整对话目标选择</a></td></tr><tr><td><strong>通过脚本设置对话目标</strong><br>使用以下方法通过代码切换对话对象： <code>TalkTo</code>；使用以下方法设置房间打开时的初始角色： <code>SetInitialCharacter</code>.</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/script-the-conversation-target.md">编写对话目标脚本</a></td></tr><tr><td><strong>编写自定义目标选择规则</strong><br>实现以下接口，即可完全替换内置模式： <code>IConversationTargetProvider</code>.</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/custom-targeting-rule.md">编写自定义目标选择规则</a></td></tr><tr><td><strong>对话目标选择参考</strong><br>查看以下类型的所有公共成员： <code>ConversationTargetingOptions</code> 及其默认值。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/targeting-reference.md">对话目标选择参考</a></td></tr><tr><td><strong>排查对话目标选择问题</strong><br>解决目标无法切换、不断闪烁或完全不会移动的问题。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/troubleshooting.md">对话目标选择故障排查</a></td></tr></tbody></table>

### 目标选择如何融入场景

只有当场景中注册了多个 `ConvaiCharacter` 时， `ConvaiManager` 才需要选择目标——只有一个角色的房间无需选择。该设置位于 Inspector 的 **Convai Manager → Who The Player Talks To** 中，且仅在场景中存在第二个角色时才会显示此部分。有关房间如何在目标选择生效前组建角色列表，请参阅 [多角色会话的工作原理](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions/how-multi-character-sessions-work.md) 。

### 后续步骤

先阅读 [对话目标选择的工作原理](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/how-conversation-targeting-works.md) 了解目标选择模型，然后阅读 [选择目标选择模式](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/choose-a-targeting-mode.md) ，选择适合摄像机和控制方式的模式。

{% content-ref url="/pages/f76eaea2a343c7d72b93487d582ec00dd7ba1c58" %}
[多角色会话](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions.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/conversation-targeting.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.
