> 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/unreal-engine/guides-v2-under-development/getting-started/adding-premade-chat-and-settings-ui.md).

# 添加预制聊天和设置 UI

本指南的目标是通过重新指定玩家蓝图的父类，轻松展示如何将预制的聊天和设置小部件添加到 UI 中，我们将继续基于 [简单对话立方体](/api-docs/zh/cha-jian-yu-ji-cheng/unreal-engine/guides-v2-under-development/getting-started/simple-talking-cube.md) 指南。

{% hint style="info" %}
在继续本指南之前，建议先从上一份指南中创建的玩家蓝图中移除 Convai Player 组件。
{% endhint %}

1. （可选）如果你还没有玩家蓝图，那么你可以将第一人称或第三人称内容导入到你现有的项目中。
   1. 在内容浏览器中，点击添加按钮，然后 `向项目添加功能或内容包` 然后选择以下任一项 `第一人称` 或 `第三人称` 然后点击 `添加到项目`.\
      ![](/files/21174617541b8a19d2fcda98070a4e1904dd4440)\
      ![](/files/65e8c6462154ab56216611f358d018db3eb8cf04)
   2. 点击窗口菜单，并确保 `世界设置` 被启用时自动发现它。\
      ![](/files/51e3867d64fda37f7da33e12eb08c67d65089ff9)
   3. 在 `世界设置` 选项卡，找到 `游戏模式覆盖` 并将其设置为 `BP_FirstPersonGameMode` 用于第一人称，或者 `BP_thirdPersonGameMode` 如果你导入的是第三人称内容。\
      ![](/files/a1e55257bcbf0f32372ac28f8f93751362b366c7)<br>
2. 在内容浏览器中，找到你的玩家蓝图，其默认路径为 `FirstPerson/Blueprint/BP_FirstPersonCharacter` 用于第一人称，或者 `ThirdPerson/Blueprint/BP_ThirdPersonCharacter` 这是第三人称的默认路径。
3. 打开蓝图并点击 `类设置` 然后在 `Details` 部分下的 `类选项` 将父类更改为 `ConvaiBasePlayer`.

<img src="https://lh3.googleusercontent.com/yXsy1Zy7lfMCTEcj8wqpTZI44UbaDDYiasR9dWFnhzZmTvkV2cXy5-B0U9jNRI2U2lg9jBSkai57RIQ_InSSuaImlCuQIh9LNJaCrZ4Y3wTme_fj6gfMzsBf_HfWE9ICt7Tk_V4J5gs4JH6Ibvlq-Sc" alt="" data-size="line">

<figure><img src="https://lh4.googleusercontent.com/IIukEpo8niZHMAox4z4f-dkre2apO9DHZMKTGzCHfbYFSOZBSboGPnvhlKTDJdDvMTzuN7XND-3z52x42GlpiH1omXDrEeAq3crnK79_EFBobHAByuQtOP1QJbg04ZemJq0eojJb4DiRwyZoo4WNCuY" alt="" width="375"><figcaption><p>设置父类</p></figcaption></figure>

4. 点击保存、编译并运行进行测试——使用 T 键进行对话，按 Enter 进行文字聊天。\ <br>

   <figure><img src="/files/2ecf75b04b5ccf5828e36545dddc03051bfc1f87" alt=""><figcaption></figcaption></figure>
5. 按 F10 打开设置菜单，其中有多种选项，例如测试麦克风和更改聊天小部件布局。

   <figure><img src="/files/8e5de7eda98294712f5d8c96b3e42de57af712e1" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
对于高级用例，你可能不想更改玩家蓝图的父类，在这种情况下，我们建议你使用 `Convai Base Player` 蓝图本身作为参考，查看如何添加聊天和设置小部件，甚至从零开始创建你自己的小部件。\
\
我们期望那些希望从头实现一切或进行定制的开发者，已经足够熟悉，能够独立浏览这些蓝图。
{% endhint %}


---

# 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:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/unreal-engine/guides-v2-under-development/getting-started/adding-premade-chat-and-settings-ui.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
