Why does ULevelStreaming->GetFName return weird results?

I’m trying to assemble a TArray<FName> containing the name of every map in my game. As a test, I added five streaming levels to the persistent level, appropriately named StreamTest0 through StreamTest4. I then queried UWorld::StreamingLevels to get a reference to them at runtime:

TArray<FName> AWorldManager::GetAllMapNames() {

	TArray<FName> nameList;
	TArray<ULevelStreaming*> tempLevels = GetWorld()->StreamingLevels; //Get a reference to every level configured to stream in

	for (int i = 0; i < tempLevels.Num(); i++) { //Iterate through the list, and get the name of each level

	return nameList;

This returns the correct number of names, but instead of “StreamTest0” my first map isnamed “LevelStreamingKismet_0,” and the remaining four are predictably named LevelStreamingKismet 1-4. I tried substituting GetWorldAssetPackageFName() for GetFName() with the hope that it’d return the asset’s name instead of the weird Kismet string, but in addition to the asset’s name the package name returned the complete filepath, as in “/Game/Maps/StreamTest0”. Is there a function I’m not seeing in or in intelisense that will return the map name, but will not add the entire file path first?

Try something like this instead

for (int i = 0; i < tempLevels.Num(); i++)

Hmm, GetWorldAsset() returns null when that executes at runtime… since I’m using world composition though, wouldn’t UStreamingLevel::GetWorldAsset() always return GetWorld()?

Edit to add: this can’t possibly be the most efficient way to accomplish this, but I found that FPackage has a function that turns asset paths into asset names, so this does the trick just fine: