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

# 对话目标选择故障排查

修复在 Convai 多角色房间中无法切换、在角色之间闪烁或始终不移动的对话目标。

诊断为什么在多角色房间中，对话目标没有选择你预期的角色。下面的每一项都涵盖了你在播放模式中可以观察到的一种症状。

### 开始之前

* 选择 `ConvaiManager` 在播放模式下的检查器中并打开 Live 部分。它会显示当前被对话指向的角色、玩家是否可以与其交谈，以及上一次目标选择决策背后的判定结果。
* 打开 **Convai → Troubleshooter** 用于一次性报告，其中会连同其余对话状态一起覆盖目标选择。如果你与编码助手配合使用， `Convai.DiagnoseConversation` 该工具会报告相同的信息，包括目标选择规则及其取值，以及这些取值是否仍为出厂默认值。
* 确认场景中有两个或更多 `ConvaiCharacter` 个已注册的组件——对于只有一个角色的房间，目标选择逻辑根本不会运行。

### 看向某个角色并不会将对话切换到他们

**症状：** 玩家的视线明显落在某个角色上，但对话仍停留在另一个角色身上，或者停留在无人身上。

**原因：** 该角色的距离或角度超出了 `MaxDistance` 或 `MaxAngle`，因此它不符合被指向的条件。

**修复：**

1. 打开 `ConvaiManager` → **玩家与谁对话** 并检查 **范围（米）** 和 **视角（度）**.
2. 放宽正在排除该角色的那个值。参见 [调整对话目标选择](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/tune-targeting.md).

**验证：** 一旦玩家的视线进入范围和角度内，Live 部分就会把该角色报告为被指向。

### 对话在两个角色之间闪烁切换

**症状：** 被指向的角色会在两个候选者之间来回切换，而玩家的视线或位置并没有明显变化。

**原因：** `SwitchMargin` 或 `SwitchDelaySeconds` 对于角色站得如此接近的情况来说太低了，因此很小的镜头移动就足以触发切换。

**修复：**

1. 提高 `SwitchMargin` 先——它在以下项下以度为单位测量： `LookAt`.
2. 如果闪烁仍然持续，也提高 `SwitchDelaySeconds` 。

**验证：** 当玩家的视线大致保持在某一个候选者上时，Live 部分中的被指向角色保持稳定。

### 完全没有任何切换

**症状：** 无论玩家看向哪里或如何移动，对话都不会切换到其他角色。

**原因：** `ConversationTargeting.Mode` 设置为 `手动`，因此除了调用 `TalkTo`.

**修复：** 确认 **选择方式** 中的字段 **玩家与谁对话**。如果 `手动` 是有意为之，则使用以下方式驱动目标： `TalkTo` ——参见 [脚本化对话目标](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/script-the-conversation-target.md)。如果这不是有意为之，请切换为 `LookAt` 或 `接近`.

**验证：** 当玩家看向或接近其他角色时，Live 部分中被指向的角色会发生变化。

### `TalkTo` 似乎没有任何作用

**症状：** 调用 `manager.TalkTo(character)` 不会推进对话，并且控制台会记录 `[ConvaiManager] 无法与“<name>”交谈：它不在当前房间中。只有加入此连接的角色才能被指向。`

**原因：** 传递给 `TalkTo` 的角色不是当前房间的成员——它要么从未注册，要么在房间连接后离开了房间。

**修复：** 确认该角色是以下项之一： `ConvaiCharacter` 加入当前连接的组件。 `manager.ConversationTarget` 以及房间名单确认当前成员资格。

**验证：** 警告不再出现，且 Live 部分会将请求的角色报告为被指向。

### 对话似乎卡在一直保持某个角色

**症状：** 尽管玩家显然已经不再看着他们或靠近他们，被指向的角色却没有变化。

**原因：** 这可能是正确行为，而不是故障。目标不会自行清空——当当前没有人符合资格时，最后一个被指向的角色会继续维持对话，而不会让对话沉默。

**修复：** 检查 `ConvaiManager.ConversationTargetingStatus` （或 Live 部分的判定结果）来区分被保持的目标和卡住的目标—— `AlreadyActive` 或 `HeldForDelay` 意味着目标选择正按设计工作。如果即使玩家明显在指向新角色时判定结果也从不变化，请检查该角色在当前条件下是否有资格。 `MaxDistance` 和 `MaxAngle`.

**验证：** 将一个真正符合条件的角色移动到范围和角度内，会改变被指向的角色。

### 相关页面

{% content-ref url="/pages/bf13178545671bf5315d6096bbd1d925cf1b57a5" %}
[对话目标选择如何运作](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/how-conversation-targeting-works.md)
{% endcontent-ref %}

{% content-ref url="/pages/2c6d63cffd7b1ec0697bd7dd2aa8bd901ef1f717" %}
[排查多角色会话问题](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/multi-character-sessions/troubleshooting.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/troubleshooting.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.
