Download

Destroying spawned actors?

EDIT: Solved! Thanks Shigan5

Hi all.

I am wondering how to destroy a spawned item after a delay. Please see my attached image. Am I missing something obvious? :S

screenshotHtml5LaunchHelper.jpg

The item spawns fine but won’t destroy after the delay.

Thanks in advance for any help.

(NOTE: The first Destroy actor just refers to the actor in my inventory, which works fine. The second Destroy Actor node is supposed to be destroying the actor that was placed in the world)

I would say try debugging the bp code to see where the execution fails. But I’m thinking it is because you’re destroying the actor that calls the function to destroy the spawned one, before it calls the destroy code. So it may not ever hit that last delay/destroy. Especially if UE has cleaned up the actor already during the delay.

What I would do, is have the actor that gets spawned/destroyed have an “OnBeginPlay” and make it start its own timer and destroy itself.

Many thanks! Your solution was correct. I should have debugged and figured that out on my own >.< New to UE4 and always forget about the feature where you can see data flow through the blueprints =p

I just swapped around the order of the destroy actors (Connected the return value on the Spawn Actor to the first one, instead of the second.)

Awesome! Glad it worked for ya. :smiley: