Is there a way to limit the search for actors by sub level? Example: Get all Actors of Class → ForEachLoop → DestroyActor destroys all actors, in every level. I just want to limit that to one sub level. Is this possible in blueprints?
No, this isn’t possible. The “GetAllActorsofClass” node will pull all actors within the game world, which includes all sub levels.
The best work around would be to store a list of specific actors within an array and then delete all objects in that array when you no longer need them.
I know this is an old thread but wanted to add an answer for future people since I ran into the same problem. You can do it in C++ (using StaticMeshActor as an example):
You can get all actors of class and then loop through the array and check the outer object. You might have to do multiple outer object checks until it returns object of class World.