Is it possible to get an array / list of all actors within a specified distance from the pawn using blueprints?
Let’s say when an event triggers I have to destroy ALL actors (static meshes, lights, particle effects etc.) that are 10.000 units around the pawn. How about doing that?
For a blueprint, you can use the Get All Actors of Class node to get all actors of a particular class (including just Actor) and then use that Array with a ForEachLoop as Rama mentions. In the loop, you can use the following setup to do a distance comparison and then execute whatever additional code you want after the Branch:
Instead of tracing, or a foor loop for all actors of class…
A proper (best practice) would be to add a gameplay tag to the actors when they spawn in, then loop the actors with that game-play tag to check a distance.
Tags are accessible via the string array variable Tags.
Though, you may need to edit the actor’s class in CPP to make the variable available, this I do not recall…
The loop should be less expensive than a multi trace - when dealing with high number of actors/items that react to the trace.