Nonmutual Actor Parent-Child relationship inside RerunConstructionScripts


We hit a situation in 4.14.1 in which the following check inside ‘AActor::RerunConstructionScripts’ would get hit when duplicating a Blueprint actor from within a level

check(AttachedActor->ParentComponent->GetOwner() == this);

This particular Blueprint actor would add a child actor from within its construction script.
When I recreated this scenario inside a clean 4.14.1 project, this did not happen.

Digging deeper, it seems that this might be related to the order of execution for the initialization of Actors involved in a construction script. In our case, we got the parent actor calling RerunConstructionScripts before the child actor’s ParentComponent had been updated to point to a new OwnerPrivate… I think.

At first, I figure commenting out that check would be sufficient, but it seemed that a deeper core issue here was that ‘AActor::GetAttachedActors’ would return a child that considered another Actor its ParentComponent owner, but only during this duplication-construction window in which all of the properties seem to be in flux before instance data would get properly repointed.

I am not sure what to do about the order of execution issue or if that might be an indicator of a more sinister problem, but I figure it would be safe to assume that we only want mutual relationships from any child actors returned by GetAttachedActors. Posting this here in the hopes that somebody at Epic can chase this issue deeper than I can from the outside.

The modification I made to our version of the engine is inside ‘AActor::GetAttachedActors’




if (!(CompOwner->IsChildActor())
	|| (CompOwner->ParentComponent->GetOwner() == this))

That title is epic. Sorry I have no helpful things here