我们在打包后的版本里(Windows Test)发现,FStateTreeMoveToTask不会调用Tick。我看了一下源码,FStateTreeMoveToTask在构造函数里设置了bShouldCallTick = false,并在Compile里根据配置情况设置bShouldCallTick = true。
nEDataValidationResult FStateTreeMoveToTask::Compile(UE::StateTree::ICompileNodeContext& Context)
{
const FInstanceDataType& InstanceData = Context.GetInstanceDataView().Get<FInstanceDataType>();
// We only tick the task if we might track the destination vector
if (Context.HasBindingForProperty(FName(TEXT("Destination"))))
{
if (InstanceData.bTrackMovingGoal || Context.HasBindingForProperty(FName(TEXT("bTrackMovingGoal"))))
{
if (!InstanceData.TargetActor && !Context.HasBindingForProperty(FName(TEXT("TargetActor"))))
{
bShouldCallTick = true;
bShouldCopyBoundPropertiesOnTick = true;
}
}
}
return EDataValidationResult::Valid;
}
但Compile是一个EditorOnly的过程,我也没有找到任何地方把bShouldCallTick的值序列化保存下来,也就是说,打包之后的版本bShouldCallTick应该永远都是false。同理,其他设置如bShouldCopyBoundPropertiesOnTick应该也不会保存到打包版本里。
[Attachment Removed]