10.创建玩家 Context

新建场景查询系统中使用的 Context。

Windows
MacOS
Linux
On this page

场景查询可基于 Actor 类型生成一系列项目,但其并不会对 Context 执行此操作。因此,需要找到一种使玩家 Pawn 成为 Context 的方法,此时 EnvQueryContext_BlueprintBase 即可派上用场。

步骤

  1. 内容浏览器 中双击打开 PlayerContext 蓝图进行编辑。

  2. 覆盖 ProvideActorsSet 函数:

    override1.png

    将鼠标悬停在 My Blueprint 面板中的 Functions 部分即可显示隐藏的 Override 按钮。

    按下此按钮后,打开的蓝图图表将覆盖函数的默认行为:

    newlyOverriden.png

  3. 添加一个 Get All Actors Of Class,然后以下图中的方式将其连接在 Provide Actor Set 节点和 ReturnNode 中间:

    finalGraph.png

  4. 最后将 Get All Actors Of Class 节点的 Actor Class 设为 Top Down Character,然后 编译保存

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback