How to load a map from a Pak file 4.10?

I’ve posted this in the forums but want to put it here just in case there are more eyes…

I am trying to load a map from a Pak file in UE 4.10. I’ve looked over several of the AnswerHubs and the code and process that I use are based on the information I found there but I’m still not getting any love.

First I’ve created the pak file like so:
Created a new TopDownTemplate project and deleted everything but the map and geometry.
Built the project with the “For Distribution” flag set.
Ran the UnrealPak utility on the cooked map to create a new Pak file (MyPak.pak).
This is the pak that I will try to load.
Note that I’ve also just tried using the resulting pak from the build and still no dice.

Second I load the pak in my main application like so:
Package the project for Windows 64
Copy the MyPak file from above to the Paks folder of this packaged build.
On some keypress I call the following code from PlayerController

    if (FCoreDelegates::OnMountPak.IsBound()) 
            UE_LOG(LogTemp, Warning, TEXT("ARPGPlayerControllerBase::OnMountPak.IsBound == TRUE"));
            const FString PakFilPath = FPaths::GameContentDir() + TEXT("Paks/MyPak.pak");
            if (FCoreDelegates::OnMountPak.Execute(PakFilPath, 0))
                UE_LOG(LogTemp, Warning, TEXT("ARPGPlayerControllerBase::OnMountPak.Execute == TRUE"));
                UE_LOG(LogTemp, Warning, TEXT("ARPGPlayerControllerBase::OnMountPak.Execute == FALSE"));

Please note that at this point both IsBound and Execute return TRUE so I am assuming the Pak file is successfully mounted.

I then try to open the map from the console using “open TopDownExampleMap”
… and nothing happens. I do get the following message in my log:
LogPackageName: SearchForPackageOnDisk took 0.293s, but failed to resolve topdownexamplemap.umap.

I have seen references to external apps like UnrealFileServer but I’m not sure if this is necessary or not. Obviously I’m missing something important though. Any help would be greatly appreciated.



I’m having exactly the same problem - have you had any success? I contacted Epic over a week ago and they still have not got back to me about this.

Unfortunately I’ve still not had any luck. I did get some help from this thread but even with that help I am still unable to do this with any real success. Loading assets from a pak file - C++ - Epic Developer Community Forums

same problem here … not sure how to open a level from mounted pak file … here is my code on 4.17 …

void AHttpActor::LoadPAK() {
	//const FString PakFileName = FPaths::GameContentDir() + TEXT("testPak.pak");
	UE_LOG(LogTemp, Warning, TEXT(" o||----  mount PAK ----||o"));
	IPlatformFile& PlatFormFile = FPlatformFileManager::Get().GetPlatformFile();
	FPakPlatformFile* PakPlatformFile = new FPakPlatformFile();
	PakPlatformFile->Initialize(&PlatFormFile, TEXT(""));

	const FString PakFileName = FPaths::GameContentDir() + TEXT("testPak.pak");
	FPakFile PakFile(&PlatFormFile, *PakFileName, false);
	//FPakFile PakFile(&PlatFormFile, *PakFileName, false);
	FString MountPoint(FPaths::EngineContentDir());

	UE_LOG(LogTemp, Warning, TEXT(" o||----  MountPoint----||o + %s"), *MountPoint);


	if (PakPlatformFile->Mount(*PakFileName, 0, *MountPoint)) {
		UE_LOG(LogTemp, Warning, TEXT("----------- Mount Success"));

                           //// OPEN LEVEL/MAP ??????? HOW ??? 
	else {
		UE_LOG(LogTemp, Warning, TEXT("-----XXXX-- Mount Failed"));


#include “HAL/PlatformFilemanager.h”
#include “HAL/IPlatformFileModule.h”
#include “Archive.h”
#include “ArchiveAsync.h”
#include “Misc/Paths.h”
#include “Runtime/PakFile/Public/IPlatformFilePak.h”

@DisplaySweet did you ever work it out

Hello @DisplaySweet

I was able to get this to work well enough for my needs in 4.16. It has been over a year since I worked on this tho so I will not be able to provide a lot of feedback. However i did make notes. The code is super simple and has been documented in other threads. See below for code.

Now for the two most important caveats that are usually not mentioned clearly enough.
These are what was killing me:

  1. You MUST use a COOKED pak file. You can NOT just grab a pak from your project and use it. You have to use a command line tool to create this cooked pak called UnrealPak.exe.
  2. This will ONLY work in a packaged build. The code will ALWAYS fail in Standalone or in PIE.

There is more info on the command line in comments on this thread:

Best of luck! Code follows:

FString pakFile = "C:/Unreal Projects/DLCTest/MyCookedPak.pak";
if (FCoreDelegates::OnMountPak.IsBound())
	if (FCoreDelegates::OnMountPak.Execute(*pakFile, 0, nullptr))
//BOOM: If you get here then it worked.

Hi thanks for the reply. Where does this mount to? Engine or Game Content directory? Do you not have to call FPakPlatformFile::Mount() ?

Hey! So I have it mounting but I am unable to load a map file because it just keeps saying SearchForPackageOnDisk took 0.079s but failed to resolve modexamplemap.umap Did you experience this?