We started noticing problems on our project after updating to 5.6 whereby certain actors would be moved to the world origin during PIE or during cooking (but appeared in the right place during regular work in the editor).
We traced the problem to a change that was made in 5.6 whereby AActor::RerunConstructionScripts() is called as part of UWorldPartition::ApplyRuntimeCellsTransformerStack() processing. This causes AActor::RerunConstructionScripts() to be called outside the main component initialization flow which appears to violate some of the implied assumptions of the internals, in this case the implied assumption that the ComponentToWorld transform of all components affected by AActor::RerunConstructionScripts() has been updated at least once before components are attached or detached.
That assumption is false in the case where UWorldPartition::ApplyRuntimeCellsTransformerStack() calls AActor::RerunConstructionScripts() on a parent blueprint before its children, because this ultimately leads to a call to USceneComponent::DetachFromComponent() on the root components of it’s children before they’ve had a chance to update their ComponentToWorlds.
We’re currently testing a modification to USceneComponent::AttachToComponent() which seems to fix the problem, where we call ConditionalUpdateComponentToWorld() immediately prior to DetachFromComponent(), which made me wonder whether this is something that ought to be done in mainline too.
I’m not sure whether it’s worthwhile trying to construct a repro in unmodified UE because the repro depends on the order of cell transformer processing between the parent and child (which doesn’t appear to be under user control?)
Steps to Reproduce
The issue affects parent-child actor relationships where:
the actors involved are external actors
the actors involved are blueprint actors
the actors are subject to cell transformer processing
The issue can be observed when the affected actors are initialized for PIE or as part of cooking (so cooked builds and PIE are typically affected, but regular work in the editor is not).
I don’t yet have a solid repro in unmodified UE and I’m not sure whether it’s worth trying to construct one because the repro depends on the order of cell transformer processing between the parent and child (which doesn’t appear to be under user control?)
We ran into the same issue on 5.6, we needed to integrate CL 44081791 and CL 45834203 to fix it.
(We also integrated CL 45148913 to fix a separate Runtime Cell Transformer bug which only affected Child Actor Components, if you’re using those at all.)
I should warn you about a bug with the UWorldPartitionRuntimeCellTransformerISM that can result in duplicated instances instead of reducing the count: https://issues.unrealengine.com/issue/UE-350090
It is recommended to add Blueprints to the exclusion list for that RCT for now.
The FastGeo cell transformer does not have have problem as it ignores BP that will not be fully transformed.
Thanks James! We already have CL 44081791 and CL 45834203, and the problem is occurring even with those two changes already applied (which makes some sense, as I understand it those two changes are concerned with avoiding having AttachParent pointing to components that have been GC’d, which is a bit different from the problem I’m seeing here).
But I don’t think CL 45148913 was on our radar at all, I suspect we’ll need that too!