U++ Tick
跳到导航
跳到搜索
Actor 生成
在 BeginPlay 中,actor 将向引擎注册其主 tick 函数和其组件的 tick 函数。Actor 的 tick 函数可通过 PrimaryActorTick 成员设为在特定 tick 组中运行,或完全禁用。这通常在构造函数中完成,以确保 BeginPlay 调用前数据设置正确。一些常用代码如下:
PrimaryActorTick.bCanEverTick = true; PrimaryActorTick.bTickEvenWhenPaused = true; PrimaryActorTick.TickGroup = TG_PrePhysics;
组件 Tick
组件可以和 Actor 一样被分隔为不同的 tick 组。之前,Actor 在 Actor 的 tick 中 tick 其所有组件。这仍在发生,但需要处于不同群组中的组件将被添加到一个列表中,在这些组件被 tick 时进行管理。将组件指定到 tick 组时应使用指定 actor 到 tick 组的相同标准。组件的 tick 结构的命名方式与 Actor 有所不同,但工作方式相同:
PrimaryComponentTick.bCanEverTick = true; PrimaryComponentTick.bTickEvenWhenPaused = true; PrimaryComponentTick.TickGroup = TG_PrePhysics;