Has something changed with GetAllActors in 4.9?

Before UE 4.9 I would use GetAllActorsFromClass and it would return a combined list of actors from the persistent level and from the loaded sublevel. After upgrading to 4.9 it seems to be returning only actors from the persistent level. How can I get it to go back to loading all actors from currently loaded levels (both persistent and sublevel).

Thanks!

Alternatively you could use object and actor iterators

GetAllActorsFromClass is made for blueprints but as you noticed it can be used in C++, that function it self use iterator.

Thanks for the reply. I tried iterators but got the same result. They must have changed something in 4.9 because this worked fine since 4.7. I tried this:
for (FActorIterator It(()); It; ++It)
{
actorstest.Add(*It);
}
But got actors from the persistent level only.

Basically what I do is I load streamed level and in on BeginPlay I use getallactors. It used to return combo of both persistent level and loaded level’s actors, but now it’s only persistent level actors. I know for sure that my loaded level has actors in it, as I get their “BeginPlay” events.

Hmmm maybe other levels are in different World instances, type in “displayall World” in console and you should see list of all world objects. You could also try using Object iterator, i think it search objects (and actors are also objects) globally not via worlds

Hi,

Actually I found the issue and it’s a bug in 4.9. Here’s the tread: