Is it possible to get the names of all currently loaded levels in a persistent level without manually tracking it? Either through C++ or Blueprint?
(Note: I’m not looking for a way to get the current level name, I already know how to do this)
Is it possible to get the names of all currently loaded levels in a persistent level without manually tracking it? Either through C++ or Blueprint?
(Note: I’m not looking for a way to get the current level name, I already know how to do this)
Nevermind, found the answer after looking through source (which I should have done in the first place, sorry!).
UWorld
has the variables UWorld::PersistentLevel
and UWorld::StreamingLevels
. StreamingLevels
is a collection of ULevelStreaming
, which has all the information I need (whether it’s currently loaded, etc.).
To complement this answer, the function to get a streaming level’s name is
Level->GetWorldAssetPackageFName()
(Level is of type ULevelStreaming*, acquired from GetWorld()->StreamingLevels)
This works for both packaged and PIE. Previously I was using Level->PackageNameToLoad and Level->GetName(), which don’t work for a packaged game (only PIE), so be aware of that.