I'm making a simple project to learn Unreal Engine.

I have 50 actors (blueprints) and at the start a function will loop 5 times and spawn 5 of the 50 actors randomly.

How can I destroy the actors by pressing a button, irrespective of which of the 50 actors are spawned?

  • \$\begingroup\$ Have you searched online for "Unreal Engine destroy actor" ? I just did and got numerous promising results. If you tried them and they didn't work for you, could you describe what went wrong? That way people won't spend their time writing an answer for something you've already tried. \$\endgroup\$ Nov 29, 2019 at 10:19
  • \$\begingroup\$ Are you using Spawn Actor From Class? \$\endgroup\$
    – Stephen
    Nov 29, 2019 at 10:45
  • \$\begingroup\$ Hi yes i have a function that will spawn an actor from class and that will run 5 times. I know how to dostroy them but in this situation I will not know which of the 50 actors will spawn. And the only solution i have now is to destroy all of them \$\endgroup\$
    – NameHere
    Nov 29, 2019 at 11:09

1 Answer 1


As you're using SpawnActorFromClass to create these actors, you need to tell Unreal what they are so that later, it can find a reference to them and destroy them.

Create an Array of Actors and before you run your loop, make sure you empty it.

The SpawnActorFromClass module has a "Return Value" pin which you can use to add items to this array.

When it's time to destroy the actors, loop through the array and with a Get box, call "Destroy Actor" command, plug in the output pin of the Get to destroy all 5 actors.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .