i have a blueprint where i randomly spawn 600 trees and i want to know how do i destroy them later. i have tried the destroy actor node with no luck. i also added a for loop node to fire 600 time but it still doesn’t work. any ideas?
How destroy works. Well, it is a node needs a single input, which is going to be the actor meant to be destroied. So you can’t pass a spawned actor, as this will destroy only 1 not the 600.
Now as i can see, those trees are type of “Mushroom”. Best practice, if you want to destroy all the new 600 later, you make an array type of actor, and once you spawned a new Mushroom, you connect a “Add” node to the “Return Value”, to add it to the array.
Later when you need to destroy all of them, you do a for/foreach loop using the array variable size (length), and you use destroy to destroy each instance using it’s index within the array. and connect the destroy out of the “Get” node.
“Target” pin actully accepts array so there is no need for ForEachLoop if you want to just call single function
thank for the answers! with some googleing about arrays i just found that get all actor actors from class and then destroy actor also works fine.