[BUG] Child Actor Component - Blueprint compilation errors and potential Blueprint corruption - reproducible on a small test project

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.

Hello mnikonov,

I do not receive any compilation errors when compiling “MyActorBP”. Are there any additional steps needed to reproduce this issue on our end with the project provided?

Please note that the attachment contains only some files (BPs and C++ sources). All of the Blueprints in the attachment may be relevant to the problem, including the ThirdPerson_AnimBP (it makes calls to child actor).

It is possible that the size of various content files affect this errors because the problem may be related to memory corruption and how various assets lay out in memory. Maybe it goes away if you delete large content files (like meshes or music from starter kit).

I tested on two different computers (one Windows desktop, another MacOS laptop) and always see these error messages. To reproduce the problem, it is enough to just open the relevant BPs and click “Compile” button.

The error messages will be in Output Log.

When compiling MyActorBP, there will be white messages in the log saying “Trying to register component with IsPendingKill() == true”.

When compiling ThirdPersonCharacter BP, there will be a red message in the log about “Ensure condition failed: AttachParent == nullptr || !AttachParent->AttachChildren.Contains(this)”.

I can send the full test project to you so that you can reproduce the problem. Please just tell me how I can send it. The project is 32 Mb in size (compressed) so I cannot upload it to Answerhub. It is a very simple test project based on ThirdPerson template, with some music from StarterContent added to it.

I just downloaded 4.18 preview 2 for Mac and seems like the second error is gone.

(In my original post, I incorrectly mentioned testing on 4.18 preview 2, but in fact I was testing on 4.18 preview 1).

I will do some additional testing to see if this solves the BP corruption problem on my other (bigger) project.

Correction - originally I was testing on 4.18 preview 2, and just downloaded 4.18 preview 3 that seem to fix the issue. Preview version number in Launcher updated only after restarting the Launcher, and it shows preview 3 now.

No, the 4.18 preview 3 does not fix the bug, just makes it harder to reproduce. On a small test project, I get less errors in BP compilation (the second error is gone). But on my bigger project with lots of assets, I still get the same BP corruption.

I tried downgrading test project to 4.17 but it is very difficult now that it was upgraded to 4.18. I still have a copy for 4.18p2 where the problem was definitely reproducible.

It may be difficult to reproduce without full test project. Changing just the project name without updating C++ files seems to break the BPs.

I believe this is a serious bug because it may cause pretty unpredictible corruption of BPs. That “Trying to register component with IsPendingKill() == true” is definitely not normal. I think many of the problems that people have with ChildActorComponents in recent releases may be connected to this bug.

I believe the easiest way to reproduce is on 4.18 preview 2, with the full test project (32 Mb) that I have.

Please let me know how to send it to you.

OK I managed to share the project via GoogleDrive, this is for 4.18p2:

TestProjectForChildActorBug

Hello mnikonov,

Thank you for providing a test project. I have run multiple tests however, I do not receive an Ensure when compiling “MyActorBP”. Are there any other steps that I need to take with the project provided to get the Ensure that you are seeing?

I am also having issues with this bug.
I have implemented a custom MovementComponent inheriting from UPawnMovementComponent,
however the UpdatedComponent is never initialized, because SetUpdatedComponent checks the new Component for IsPendingKill and IsValid also checks for IsPendingKill internally.

However the new Component is the RootComponent which is specified in the BlueprintActor and gets rendered and forces applied to its body all the time.

I also tried to set the UpdatedComponent with blueprints, doesn t work either.

This happened with 4.17.1

Hello ,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed list of steps to reproduce this issue on our end?
  3. Could you provide screen shots of any settings/blueprints that may be involved with this issue?
  4. If not, could you provide a stripped down version of the project that does reproduce this issue?

I have the same bug on updating from 17 to 18.1. The editor crashes when compiling particular blueprints. I’ve noticed they are blueprints referenced as child actors in other actors. I deleted and created a new child actor, but it did not help. I had a list of

“Error: === Handled ensure: ===
LogOutputDevice: Error: Ensure condition failed: ChildActorTemplate == nullptr [File:D:\Build++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\Engine\Private\Components\ChildActorComponent.cpp] [Line: 95] […] when ChildActorClass is null”

when opening the project. One by one I got rid of them by deleting and creating new child actors. But now whenever I try to compile 2 of my classes that are parent for many of the actors I get

Trying to register component with IsPendingKill() == true. Aborting.

and

Warning: Attempted to access […], but […] is pending kill.

Hello octafbr,

I have run a few tests with the information provided. However, I am still unable to reproduce this issue on our end. Could you provide answers to the questions that were ask of so that I can narrow down the issue further?

The reason why we wanted 4.18 was recording VR in wide screen, but we solved that with replication and network replay… The problem happens in blueprints that have complicated hierarchies or multiple levels of child actors. We just deleted and recreated some of them which solved the problem, until we noticed it happened in a BP that many of our classes inherit from, so we looked at other solutions. I can’t thing of more details that I can give you, but I really really hope you guys find a solution for this, I really love some of the features of 4.18!

Thank you for the information provided. However, I have not been able to reproduce this issue on our end. I am happy that you were able to find a solution/workaround the issue that you were having. If the issue returns please feel free to reopen this issue with any additional information that you may have that will help reproduce this issue on our end and I will be happy to assist you further. In order to reopen this thread, simply leave a reply containing information requested above.

Thanks,

I just noticed that I no longer get this error on 4.19 preview 4.
Looks like it is fixed.

Thank you for your support.