It is pending kill

Hi everyone. Well … My bluperint works but I have this error in the end.

And my blueprint

Someone know How can I avoid this error ?

1 Like


This is probably because you try to destroy or access it after it’s being killed or in the process of being killed.

To avoid this, before doing anything with the actor do an “IsValid?” node and from the “valid” exec drag off your function of what you want to do.


Do you need to execute it on event tick? That will fire it way lot of times and multiple “destroys” will probably be sent before the destroy false bool is ticked.

I would call those nodes once if that still works. (On event play, or after some action using an event custom node, or something like that.)

If the transforms need to be called on every tick, I would set the destroy section to be fired only once using flow control instead of a bool that is ticked at the end. I think Do N would work? Flow Control | Unreal Engine Documentation

I’m not sure exactly what the BP does.

It’s the problem, But I destroy my components and it’s that all u.u""" I don’t use it again after …

Well I will try to explain precisely:

First: If my character detects the doll then the variable doll is activated. If my variables doll and complete are true then the branch with the variable “Regarder” is enable. My doll look the character and the variable regarder is disable.

The condition becomes false and the simulate physic of the differents components of my doll are activated, the condition becomes false too with the variable “Regarder” disable at the end .

If my character sees my door, then the variable “door” is enable. The condition becomes true with “door” and “Spawn Trigger”, a trigger spawn, the variable “Trigger Spawn” is disable.

If my character see the spawn trigger then the variable “Reconstitution” becomes true. And the condition with “Reconstitution” and “Complete?” becomes True , the simulate physic for all components of my doll are disable and move, my variable “destroy” is activate, and my variable “Complete?” is disable.

Finally, if my variable destroy is activated then all components of doll are destroy and the variable “Destroy” is disable …

(the video Facebook)

In UE4 objects and actors are not destroyed imminently when they are been ordered to be destroyed (actually you can’t destroy object, they need to be destroyed by garbage collector by referencing them from everything. It’s for safety reasons specially for multithreading, so nothing unexpectedly because null or invalid and cause a heavy crash. Object that about to be destroyed are marked with so called “Pending Kill” flag and should not be relay on anymore and it seems (i didn’t know myself) that that prevents object to be used in blueprints.

So you need to check you object management what do you destroy if you destroy something don’t call on it function anymore and stuff like that.

Also i agree Pervan, your tick looks pretty heavy, i recommend you to move this to C++ and don’t use “Get All Actors by Class” (2 is even worse) on tick.If you aim for 60FPS you only have around 16ms in tick computations do things in it without FPS drop and that function loops thru all actors and if you gonna have envraments with lot of actors it might cause preformence issues, it’s not even healthy doing that in C++. Insted loop thru once in a while, in your case it seems you trying to execute this to all characters, then insted of searching for them make a register system where character on begin play register it self somewhere and it added to array and remove it self when it destroyed. No to mention you loop thru all characters it finds… it’s a clear signal that you need to move this code in to characters themselves (or else it some actor that works with all characters then i guess it’s ok), at least this tick might be multithreaded by tick manager ( i know that it’s there but not sure if it works by default)

1 Like

I would create events for each action and call them with events. For example, you can call the action when your character overlaps a collision mesh. For the door you can make the door open when your character touches an invisible collision mesh.

Here are the events - specifically I’m referring to Event Actor Begin Overlap

Here is how to make collision meshes

Maybe this helps? Is there a reason you set the events up that way? Is it a scripted sequence? Or does the player have control of their character?

For your door, you can put an invisible collision mesh in the door BP. When you click on the collision mesh you can add On Component Begin Overlap and that will give you an event node. I took a screenshot of a BP. On the top left you can see I’m highlighting a capsule component. On the bottom right you can see Event options. There you will find On Component Overlap. Good luck!

Yeah ! Thk for your help. I move the code in all actors one by one with an “DoOnce” and it works !

Thank !

This actually doesn’t seem to work, I just got this with an audio cue - the is valid validates a pending kill then gets mad when I try to destroy it.

“Same thing with 24 components” is something you should never have to say. There’s a rule of programming called DRY or “don’t repeat yourself” vs WET (write every time). What would happen if you wanted to change some tiny thing that function? You would have to change it in over 24 spots. Not only that, but its nearly impossible to read, and offers no procedural abstraction. I should be able to look at what your code is and understand it no problem. So, what you need to do is encapsablate that into a function (select all and write click, collasp into function) and now you can use it anywhere, read it easier, save so much more space, and make changes only once, not 25 times.

Thanks for the reminder to use invalids checks. I was getting a ton of sound errors even though it was still working. much cleaner log now

You should always check IsValid if you need to destroy component, otherwise you will have errors like this. I don’t know other way.

Simply use IsValid node to check before executing your function

I have a similar issue that isn’t being cleaned up from isValid checks. I’ve been working in Unreal for over 5 years and never had this issue before. I’m getting an array, checking it’s valid at the index I’m grabbing, then also verifying it isn’t being destroyed (really shouldn’t need this, I’ve never used it before), and still in the next function it says my array element (Controller object) is pending kill. Anyone seen anything like this before?

I had a similar issue when dropping items from my inventory. I put Is Valid right before Destroy and it cleared the error.

1 Like

Thank you for this, this worked for me!

1 Like

There is a node called: “IsValid?” Use it before called any command and use it after delay.