> 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/dynamic-environment-info.md). Agents can also search and read this documentation through its [MCP server](https://docs.convai.com/api-docs/~gitbook/mcp).

# 动态环境信息

无需要求响应即可将实时环境数据传递给角色。从插件版本 3.5.1 开始支持。

## 概述

动态环境信息是一项强大的功能，允许用户在不直接互动的情况下向角色传递额外的环境数据。通过增强角色感知周围环境的能力，这项功能能够带来更沉浸、更具创意的游戏体验。

例如：

* 角色可以了解 **一天中的时段** （例如：“现在是夜晚。”）。
* 角色可以获取 **库存详情** （例如：“你当前有一把枪和一瓶治疗药水。”）。
* 此功能支持结构化数据格式，以便交换更丰富的信息。

***

按照以下步骤将动态环境信息集成到项目中。

1. 在项目中打开 **角色蓝图** 。
2. 在 **Begin Play** 事件中，找到 `ConvaiChatbot` 组件。

<figure><img src="https://2402152281-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F2YNjgkKEafxVx4p64kk7%2Fimage.png?alt=media&amp;token=f9dcb823-26b3-4d88-9c87-b3488a35ffc8" alt=""><figcaption></figcaption></figure>

3. 将 `Dynamic Environment Info` 变量设置为你选择的字符串值。

* 示例 1（简单格式）：

  ```
  time of day is night
  ```

<div align="left"><figure><img src="https://2402152281-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FoeFoA65Ub43HZ7BNCwfN%2Fimage.png?alt=media&amp;token=18161eec-08b1-4396-97bd-9f32b20f88fb" alt=""><figcaption></figcaption></figure></div>

* 示例 2（结构化格式）：

  ```
  inventory: {weapon: gun, tools: [flashlight, rope]}
  ```

<div align="left"><figure><img src="https://2402152281-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FDN0Vkia5Z7nzyPpk0Lxk%2Fimage.png?alt=media&amp;token=5c0581c2-b482-4da3-900b-c977657d450d" alt=""><figcaption></figcaption></figure></div>

**保存并运行**

1. 保存蓝图更改。
2. 点击 **Play** 以测试交互。
3. 观察角色如何根据传递的信息动态作出回应。

<figure><img src="https://2402152281-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fm7JcmjIjRs79EW27fSUB%2Fimage.png?alt=media&amp;token=2ec8bcfb-0b7e-423f-9d3b-391b220c2040" alt=""><figcaption></figcaption></figure>

***

只需按照这些简单步骤操作，即可解锁更丰富有趣的游戏机制，并提升交互体验。


---

# 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/unreal-engine/guides/dynamic-environment-info.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.
