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
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 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:
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.
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.
}
};
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?