Hi,
You need map package name. GetWorld()->GetOutermost()->GetName();
In PIE map name will have special prefix like: ‘Game/Maps/UEDPIE0_MyMapName’
Hi,
You need map package name. GetWorld()->GetOutermost()->GetName();
In PIE map name will have special prefix like: ‘Game/Maps/UEDPIE0_MyMapName’
Hi
I am looking to get current map name when using world composition.
I will use it to create folder and organize data for each sub-map.
I try to use :
GetWorld()->WorldComposition->GetWorld()->GetMapName()
or
GetWorld()->GetMapName()
but I only get the name of the parent of the world composition.
Is there a way to know which level is the current active one?
Thanks
I think you misunderstood what I mean.
Your solution always give me the parent name but with the hierarchy of the folder.
But I don’t need the hierarchy of the map. I need the name of the current sub level.
For example:
My main level is “desert” (with world composition active)
I have a multiple sublevel with the name :
-“desert_landscape”
-“desert_props01”
…
If “desert_landscape” is the active level for editing, I would like to get it’s name (e.g “desert_landscape”).
After that, I’d like to use his name to create folder in the world hierarchy.
Active level in the editor is a “Current Level”, so you code should be like
FString MapPackageLongName = GetWorld()->GetCurrentLevel()->GetOutermost()->GetName();
FString MapPackageShortName = FPackageName::GetShortName(MapPackageLongName);
The code above for me doesn’t return the sublevel, but just the top (persistent level).
FString CurrentLevelName = World->PersistentLevel->GetOutermost()->GetName();
CurrentLevelName.ReplaceInline(*World->StreamingLevelsPrefix, TEXT(“”));