I’m using level streaming exhaustively to break my game into smaller Levels, which I know are of the ULevel class, but ULevel extends UObject, not AActor, so GetAllActorsOfClass won’t work in this case- is there an alternative function in the API that can run from the persistent level to return a TList of every single level in the game?
You can use TObjectIterator to iterate for any arbitrary class of object in memory. However, that does have some performance implications so use wisely.
With that said, you can use GetWorld()->GetLevels() to return you the list of levels
Ooh, thank you! Am I implementing it correctly here? This looks right to me, but unreal crashes every time I try to compile it:
levelList = GetWorld()->GetLevels();
Ack, I’m an idiot, it was crashing because I was running it in the class constructor before the world was finished instantiating. It works now, but it only returns the levels that are currently loaded- is there a way to run it once, and get every single level in the game, loaded and unloaded?
I believe there is a way to use the AssetRegistry to find unloaded content of a particular type. I know that some of the tools do that when presenting lists of maps to cook, etc. I am not familiar with that code, but there are examples of how to do that in the engine. You’ll just have to dig around a bit
Sounds good! Thank you very much for the help