> 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).
* 请在故障发生处读取控制台行。下面的消息按其原样引用。

### 输入的消息被拒绝

`ConvaiPlayer.TrySendTextMessage` 返回 `否` 并给出一个原因。 `SendTextMessage` 会将相同原因记录为一条控制台警告，前缀为 `消息未发送：`.

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

### 随附的聊天输入框保持禁用状态

| 症状                  | 原因                                                                  | 修复方法                                                                                                                                                            | 验证                                             |
| ------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| 聊天输入框始终无法交互         | `ConversationAvailability` 从未达到 `就绪` 或 `Answering` — 原因请参见上方的拒绝理由。  | 请根据上方表格进行诊断，而不是看输入框本身；输入框只反映最终结果。                                                                                                                               | 输入框的占位符显示 Ready Prompt。                        |
| 该输入框始终可交互，即使在角色还听不到 | **根据可用性门控输入** 已在……上关闭 `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` 引用，并将 Refusal Notice Seconds 设置为大于 `0`.                                                                                                         | 拒绝原因会显示，并在设定时长后自动清除。                           |

### 按键通话无法打开

`ConvaiPushToTalkController.Press()` 返回 `否` 并设置 `BlockedReason` 当其拒绝时。

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

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

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

### 仍然被阻塞

收集确切的控制台消息、当前 `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 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/conversation-availability/troubleshooting.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.
