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

# 玩家输入故障排查

修复 Convai Unity SDK 对话中的被拒绝消息、永久禁用的聊天输入框，或始终无法打开的麦克风。

大多数玩家输入问题都归因于对话可用性：一条消息、一次按键通话按下或一个打开的麦克风被拒绝了，因为被指定的角色还听不到。请在下方找到确切的消息或症状。

### 开始之前

* 用以下内容确认当前指向的是哪个角色： `ConvaiManager.AddressedCharacter`，并读取其 `ConversationAvailability` 直接——参见 [对话可用性的工作原理](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability/how-availability-works.md).
* 请阅读失败发生时的 Console 行。下面的消息按原样引用。

### 输入的消息被拒绝

`ConvaiPlayer.TrySendTextMessage` 返回 `false` 并附带原因。 `SendTextMessage` 会将相同原因记录为一个 Console 警告，前缀为 `消息未发送：`.

| 症状                                                                          | 原因                                                             | 修复                                                                                                                                                                          | 验证                                                  |
| --------------------------------------------------------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| `消息为空。`                                                                     | 传递给 `SendTextMessage` 或 `TrySendTextMessage` 的是空字符串或仅包含空白字符。   | 发送前检查输入字符串。                                                                                                                                                                 | 该调用返回 `true`.                                       |
| `没有任何内容在监听玩家消息。场景中是否有 ConvaiManager 且处于激活状态？`                               | 没有处理器订阅 `ConvaiPlayer.OnTextMessageSent`.                      | 确认 `ConvaiManager` 已存在并在场景中处于激活状态。                                                                                                                                          | 某个处理器接收 `OnTextMessageSent`.                        |
| `当前没有指向任何角色。请向场景中添加一个 Convai Character，或使用 ConvaiManager.TalkTo 将对话指向某个角色。` | `ConversationAvailability` 是 `无角色`.                            | 添加一个处于激活状态的 `ConvaiCharacter`，或者调用 `ConvaiManager.TalkTo` 以将对话指向其中一个。                                                                                                       | `AddressedCharacter` 不是 `null`.                     |
| `房间未连接。请先开始对话。`                                                             | `ConversationAvailability` 是 `离线`.                             | 发送前先连接房间。                                                                                                                                                                   | `ConversationAvailability` 不再 `离线`.                 |
| `房间仍在连接中。`                                                                  | `ConversationAvailability` 是 `连接中`.                            | 等待连接完成，或将发送 UI 受以下条件控制： `CanAcceptPlayerInput()`。请参阅 [根据可用性控制你的 UI](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability/gate-your-ui.md). | `ConversationAvailability` 超过 `连接中`.                |
| `'<character>' 还未完成加入对话。服务一确认它后就会立即响应——通常只需片刻。`                             | `ConversationAvailability` 是 `准备中`。房间已连接，但被指定的角色尚未被 Convai 确认。 | 请等待——一旦服务确认该角色，这个问题会自行解决。自定义 UI 应基于 `CanAcceptPlayerInput()` 而不是房间的连接状态来控制。                                                                                                 | `ConversationAvailability` 变为 `就绪`.                 |
| `'<character>' 在此对话中不可用。`                                                   | `ConversationAvailability` 是 `不可用`。该角色启动失败或已离开房间。              | 检查 `ConvaiCharacter` 查看底层失败的连接日志；此状态不会自行恢复。                                                                                                                                 | 该角色重新连接并且 `ConversationAvailability` 报告的结果不是 `不可用`. |

### 随附的聊天字段保持禁用

| 症状                | 原因                                                                   | 修复                                                                                                                                                              | 验证                                          |
| ----------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| 聊天字段始终不可交互        | `ConversationAvailability` 始终未到达 `就绪` 或 `应答中` ——原因请参见上方的拒绝原因。        | 请根据上方表格诊断，而不是看字段本身；该字段只反映最终判定。                                                                                                                                  | 字段的占位符显示“就绪提示”。                             |
| 字段始终可交互，即使在角色还听不到 | **基于可用性控制输入** 已在以下项中关闭： `ChatTranscriptUI`.                          | 重新启用它，或者接受玩家会通过被拒绝而不是通过字段关闭来得知。参见 [自定义聊天字段提示](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability/customise-chat-prompts.md). | `ConvaiPlayer.TrySendTextMessage` 无论如何仍会拒绝。 |
| 拒绝原因从不显示在屏幕上      | 否 `TMP_Text` 已分配给 **提示文本** 位于 `ChatTranscriptUI`，或 **拒绝提示秒数** 是 `0`. | 分配一个 `TMP_Text` 引用，并将上方的“拒绝提示秒数”设为 `0`.                                                                                                                         | 拒绝原因会显示，并在配置的持续时间后自行清除。                     |

### 按键通话拒绝开启

`ConvaiPushToTalkController.Press()` 返回 `false` 并设置 `阻止原因` 当它拒绝时。

| 症状                                 | 原因                                                        | 修复                                                                                                                                                                                        | 验证                       |
| ---------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| `当前会话未启用按键通话。`                     | 解析出的轮流发言策略不是 `PushToTalk`.                                | 将按键通话配置为对话输入模式。参见 [配置对话输入模式](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started/configure-conversation-input-mode.md).                                                    | `Press()` 返回 `true`.     |
| `按键通话需要一个处于激活状态的房间连接。`             | 按下控件时房间未连接。                                               | 在允许按下之前等待房间连接。                                                                                                                                                                            | `Press()` 返回 `true` 连接后。 |
| `按键通话无法解析目标角色。`                    | 无法解析目标角色——没有分配显式目标，没有被指定的角色，而且场景中有多个角色。                   | 分配一个显式目标，或者使用 `ConvaiManager.TalkTo` 后再按下。                                                                                                                                                | `Press()` 解析一个目标角色 ID。   |
| `'<character>' 目前还听不到玩家（<state>）。` | 被指定角色的 `ConversationAvailability` 不接受输入——房间已连接，但该角色尚未被确认。 | 等待 `ConversationAvailability` 报告 `就绪` 或 `应答中` 后再允许按下，或者像以下一样控制该控件： [根据可用性控制你的 UI](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability/gate-your-ui.md). | 一旦可用性接受输入，按下就会成功。        |

### 多角色房间中麦克风始终不会打开

| 症状                                          | 原因                                                                                    | 修复                                                         | 验证              |
| ------------------------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------- | --------------- |
| `10 秒后仍在等待房间确认其第一个角色。麦克风保持关闭，并将在该角色准备好时打开。` | 免提自动启动会等待房间确认其第一个角色后再打开麦克风，而不是在传输连接后立即打开。在多角色房间中，这可能会超过 10 秒。                         | 这是预期行为，不是故障——第一个角色一经确认，麦克风就会打开。如果等待时间持续过长，请检查为什么该角色确认得这么慢。 | 麦克风打开，警告不再反复出现。 |
| 麦克风打开得明显比单角色场景更晚                            | 符合预期。单角色房间的会话只会到达 `已连接` ，因为其角色已经被宣布，所以没有额外等待。多角色房间可能会到达 `已连接` 在第一个角色被确认之前，而麦克风会等待该确认。 | 无需修复——这是这两种房间形态之间预期的差异。                                    | 不适用             |

### 仍然受阻

收集确切的 Console 消息、当前的 `ConversationAvailability` 为这两者 `ConvaiManager` 以及具体的 `ConvaiCharacter` 所涉及的内容，以及当可用性报告后同一输入是否成功 `就绪`.

### 相关页面

{% content-ref url="/pages/416bc976c2de7ded4dd1e60ced7894e179974b5b" %}
[对话可用性如何运作](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability/how-availability-works.md)
{% endcontent-ref %}

{% content-ref url="/pages/529a05fa8aa08e60134072820b4eee04f3269f6f" %}
[对话可用性参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability/availability-reference.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-availability/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.
