Loading a map from a pak file

Hi everyone!

I currently have a pak file that I’m mounting to my game at runtime and it seems to be mounting okay. I’m using the following code to do so:

FString FullFilePath = "D:/PAKS/usethis2.pak"
if (FCoreDelegates::OnMountPak.IsBound())
{
    if (FCoreDelegates::OnMountPak.Execute(FullFilePath, 0, nullptr))
    {
        GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::FString("Mount Success"));
    }
}

I get the “Mount Success” message on packaged builds so that’s great. From the reading I’ve done though, apparently I’m supposed to just be able to say UGameplayStatics::OpenLevel(GetWorld(), "test"); Where “test” is the name of the map inside the pak file that I just mounted. When I do that it tells me that it is unable to resolve name “test.umap” and just reloads the current map.

I’ve been having trouble finding out information about where paks get mounted with this approach and how to actually access the data inside of the pak file once mounted.

Does anyone have any insight on this? I know people have done it, but it seems like everyone who has done it has kind of disappeared.


**Some information about my project, I think the problem has to do with where it is being mounted.**

The project I’m loading the pak file into is located here: D:\UE4\4.17\PakTest

The project I’m building the pak file with is located here: D:\UE4\4.17\PakSource

The actual pak file I’m mounting is here: D:\PAKS\usethis2.pak

Within the pakfile it says the path to my map is: "PakSource/Content/test.umap"

The line in the PakList file it generates after building PakSource is this: “D:\UE4\4.17\PakSource\Saved\Cooked\WindowsNoEditor\PakSource\Content\test.umap” “…/…/…/USETHIS/Content/test.umap” -compress

That is the PakList file I use to generate the .pak file.

If someone could give me a hand I would greatly appreciate it, I’ve been bashing my head into a wall on this step for about 1.5 weeks now and I might go crazy if this takes much longer.

Thank you,

Testy