Got the following errors when compiling a Blueprint with ChildActorComponent:
BlueprintLog: New page: Compile MyActorBP
LogActorComponent: RegisterComponentWithWorld: (/Engine/Transient.World_0:PersistentLevel.DESTROYED_MyActorBP_C_CHILDACTOR_20.MyMesh) Trying to register component with IsPendingKill() == true. Aborting.
LogActorComponent: RegisterComponentWithWorld: (/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.DESTROYED_MyActorBP_C_CHILDACTOR_952.MyMesh) Trying to register component with IsPendingKill() == true. Aborting.
and
BlueprintLog: New page: Compile ThirdPersonCharacter
LogOutputDevice: Error: === Handled ensure: ===
LogOutputDevice: Error: Ensure condition failed: AttachParent == nullptr || !AttachParent->AttachChildren.Contains(this) [File:/Users/build/Build/++UE4+Release-4.18+Compile/Sync/Engine/Source/Runtime/Engine/Private/Components/SceneComponent.cpp] [Line: 1601]
LogOutputDevice: Error: SetupAttachment cannot be used once a component has already had AttachTo used to connect it to a parent.
Here is a screenshot of call stack:
With the above errors, the game still plays in editor.
I have a small test project, based on ThirdPerson C++ template, to reproduce this bug. The project is 32 Mb, so it is not possible to attach it here. How can I send it to engine developers?
I attached a [small archive with just the essential files][2] (C++ sources and relevant blueprints) to reproduce the error. These can be added to a ThirdPerson C++ template project. To see the errors, one must open and try to compile (hit “Compile” button) the MyActorBP and ThirdPersonCharacter Blueprints.
Error is reproducible both on Windows and MacOS, and engine versions 4.18 preview 2 and 4.17.2.
On a much bigger project with lots of assets, similar blueprint compilation errors result in corruption of blueprints and inability to package the project (although it still plays in editor just fine). But so far I was unable to reproduce corruption on similar small test project.
Even without blueprint corruption, I believe the blueprint compilation errors still indicate a bug in engine code.
Steps to reproduce definitely involve building a base class for child actor in C++ with hierarchy of scene components (more then one level - for example, skeletal mesh as root and static meshes as children), then creating a Blueprint class based on it, then adding a child actor component with this BP to some pawn like ThirdPersonCharacter BP. It is possible that accessing parent pawn (via GetAttachParentActor()) from within child actor may also contribute to the errors.
This bug makes ChildActorComponents unusable on my project for now. As a workaround, I reverted to just spawning actors, but this is not very elegant.