Get All Actors of Class & Streaming Levels

How does one get all the actors of a class across all visible streaming levels?

I noticed that the function returns all the actors across all streaming levels if called within any level blueprint. But if called from a GameInstance or from a Widget blueprint only the Actors under the presentient level are returned.

I also noticed that if GetAllActorsOfClass is used within a blueprint function there is a World Context Object input.

Is there any documentation or a tutorial on this?


Oddly enough if I create the UI widgets from within the Persistent Level a call to GetAllActorsFromClass from within that UI widget has access to all actors. I just don’t understand why this is the case.

I use the streaming level blueprint to Get All Actors of Class in case of content actually in that level, and user Get All Actors of Class on the GameInstance when it is about something inside the persistent level.

In example, GameInstance for things like Ocean, Sky, Sound bp’s, level blueprint for triggering lights. Perhaps a LB is calling all ‘loaded/streamed’ actors in the world, but this might be relevant, e.g. trigger all visible lights. Alternatively call a function on the GameInstance each time a new level is streamed, but this would be huge when it has to include every relevant actor of all levels. Compartmentalization is probably more economical.

ok Thanks for your help. I’m looking to stream in/out combat levels and place the player’s characters at specific locations within the combat level. My game is squad based to I’m trying to pull in each start location using the GetAllActorsofclass function. I also want to load all the NPCs I placed within the level into my combat tracker (as the game is turn based).

My thought was that I could call GetAllActorsOfClass after the sub level was loaded to setup the initiative system.

The problem is that I was trying to do all of this from the GameInstance which can’t see anything inside sublevels. CallActorsOfClass does not return any sub level actors it only sees the actors in the PL.

I wanted to create a few functions inside the game instance that activated each sub level using event delegates. It seems that I can’t do that since the PL is the object that has access to everything, not the GameInstance.