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

# 调整对话目标选择

调整范围、视角、切换余量和切换延迟，使对话目标选择与角色之间的距离相匹配。

调整 `对话目标选项` 位于 `ConvaiManager` 当默认的范围、角度或切换行为不适合你的场景时——例如彼此站得很近、很容易把对话切换走的角色，或者对于宽屏来说视角太窄。请在中选择一种模式后使用此页面 [选择一种目标模式](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/choose-a-targeting-mode.md).

### 前提条件

* 已选择一种目标模式（`注视` 或 `接近`)
* 熟悉 中“符合资格”与“切换”的区分 [对话目标选择的工作方式](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/how-conversation-targeting-works.md)

### 了解每个数值控制什么

`最大距离` 和 `最大角度` 决定谁 **符合资格** 可被提及。 `切换边距` 和 `切换延迟秒数` 决定一个符合资格的挑战者在满足条件后有多愿意接管对话，并用于防止目标在两个候选对象之间闪烁切换。当角色根本无法被提及时，先看第一组；当对话切换得过于容易或不够容易时，再看第二组。

| 字段       | 默认值     | 控制                                                                             |
| -------- | ------- | ------------------------------------------------------------------------------ |
| `最大距离`   | `30` 米  | 角色可以离多远而仍然符合资格。                                                                |
| `最大角度`   | `35` 度  | 从视线方向测量，角色距离视野中心多远时仍然符合资格—— `35` 会形成一个 70 度的锥形范围。                              |
| `切换边距`   | `10` 度  | 另一个角色需要比当前对象高出多少，才会将对话切换给他们。适用于 `注视` 仅此，因为它是按度数测量的。                            |
| `切换延迟秒数` | `0.2` 秒 | 另一个角色需要保持最佳选择多长时间，对话才会切换给他们。对于 `接近`，这就是区分两个距离相等角色的因素，因为 `切换边距` 对于以米为单位的规则没有意义。 |

### 调整这些值

{% tabs %}
{% tab title="检查器" %}
选择 `ConvaiManager` GameObject 并打开 **玩家与谁交谈**。调整 **范围（米）**, **视角（度）**, **切换边距（度）**，以及 **切换延迟（秒）**.
{% endtab %}

{% tab title="C#" %}

```csharp
ConvaiManager manager = ConvaiManager.ActiveManager;
manager.ConversationTargeting.MaxDistance = 15f;
manager.ConversationTargeting.MaxAngle = 20f;
manager.ConversationTargeting.SwitchMargin = 15f;
manager.ConversationTargeting.SwitchDelaySeconds = 0.4f;
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
每个字段都会钳制到各自有效范围内： `最大角度` 介于 `1` 和 `180` 度， `切换边距` 介于 `0` 和 `90` 度，并且 `最大距离` 和 `切换延迟秒数` 最低为 `0`。将值设置在该范围之外时，会将其钳制而不是抛出错误。
{% endhint %}

### 验证更改

在已注册两个或更多角色的情况下进入 Play 模式。移动玩家的视角或位置，并确认目标会在你预期的点切换——更窄时更严格， `最大角度`更长时更慢， `切换延迟秒数`。查看 `ConvaiManager` Inspector 的 Live 部分，以查看被提及的角色以及上一次决策背后的判定结果。

### 常见调整

**对话在两个附近的角色之间来回闪烁。** Raise `切换边距` 先调整 `切换延迟秒数` 如果闪烁仍然继续。

**看着某个角色并不会将对话切换到他们身上。** 他们的距离或角度可能超出 `最大距离` 或 `最大角度` ——放宽限制他们的那个参数。

**在扫视房间时，目标切换得过于积极。** Raise `切换延迟秒数` 因此，匆匆一瞥不再会被视为在经过的每个角色身上发起对话。

### 下一步

{% content-ref url="/pages/8ebdb90f75876aa6a33c36e080adab2e377b1140" %}
[对话目标选择参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/targeting-reference.md)
{% endcontent-ref %}

{% content-ref url="/pages/95abf0b99847b20d9974a37b48ecd2a7c47c4c77" %}
[对话目标选择故障排查](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-targeting/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/tune-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.
