Map from .pak file loads but no meshes/materials

Hi everyone!

I’ve been working on this for a few days and I finally have it to a place where I think I’m close to it working. I’m trying to build a system which allows a user to download a .pak file from a server (this part is working) and launch a level from it in the game. Each .pak file is essentially a packaged level. Everything is working and I finally made it so that i can open console and type open minimal_default and it will load the level. (I have created a pak file from a blank project with starter content following these instructions)

The level loads, but none of the meshes or materials load, it’s just an empty map. When I check the logs, I get this message repeated for each asset.

LogStreaming: Error: Couldn't find file for package /Game/StarterContent/Props/SM_TableRound requested by async loading code. NameToLoad: /Game/StarterContent/Props/SM_TableRound
LogStreaming: Error: Found 1 dependent packages...
LogStreaming: Error:   /Engine/LevelTest/Content/StarterContent/Maps/Minimal_Default

My Code:
This is the code I’m using the mount the pak file.

UE_LOG(LogTemp, Log, TEXT("MountPak(%s)"), *FullFilePath);

// get mod UID
FString PathPart, FilePart, ExtPart;
FPaths::Split(FullFilePath, PathPart, FilePart, ExtPart);
FString PathPart2, ModUID, ExtPart2;
FPaths::Split(PathPart, PathPart2, ModUID, ExtPart2);
UE_LOG(LogTemp, Log, TEXT("ModUID=%s"), *ModUID);

IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
FPakPlatformFile* PakPlatform = new FPakPlatformFile();
PakPlatform->Initialize(&PlatformFile, TEXT(""));
FPlatformFileManager::Get().SetPlatformFile(*PakPlatform);

if (PakPlatform->Mount(*FullFilePath, 0, *(FPaths::EngineContentDir()))) {
    UE_LOG(LogTemp, Log, TEXT("Successfully mounted %s at %s"), *FullFilePath, *FPaths::EngineContentDir());
}
else
{
    UE_LOG(LogTemp, Warning, TEXT("Failed to mount %s"), *FullFilePath);
}

Subscribing to this topic. Did you ever find a working solution ?

Sort of. So I was unable to get it to mount and work while the game was running, so I opted to just force the user to restart the game to get the new content. That’s easy and done by just storing the pak file in FPaths::GameContentDir()/Paks/ (can be in any subdirectory of the Paks folder). Then when the game starts it automatically pulls in all the content from every pak file in there.

How are you generating your pakfiles? The only way I was really able to get it to works was to have any extra content as a plugin for my game. Then I would build the entire project so that it would add the .uplugin file to the game’s .pak, and then I’d take all the content from that plugin and put it in it’s own pak.

When a pak is generated, it creates a paklist.txt file that has a list of all of the content in the game. It became a pretty manual process but I would basically build the entire game including the plugins, then go into that paklist.txt, and separate the list into different paklists that I made myself. The first paklist would be for the main game’s content, including everything not in the plugins except for their .plugin files.

So say I have a game with a plugin called DLC that I want to be my DLC content. I would build the entire project, which would generate a file called something like Paklist_Project-WindowsNoEditor.txt. That file would contain the following (it’s more complex than this but this will get the point across):

  • MainLevel.umap
  • Character.uasset
  • DLC.uplugin
  • DLC/dlcmap.umap

I would separate this file into two different paklists. Game-Paklist.txt would contain:

  • MainLevel.umap
  • Character.uasset
  • DLC.uplugin

And DLC-Paklist.txt would contain:

  • DLC/dlcmap.umap

Then, using the command line tool for pakfile creation (UnrealPak.exe), I would create two .pak files using each of these new lists with the following commands:

  • UnrealPak.exe Project-WindowsNoEditor.pak -Create=Game-Paklist.txt
  • UnrealPak.exe DLC.pak -Create=DLC-Paklist.txt

(I recommend automating this process with a script as it can be annoying to do manually)
I could then load DLC.pak and its contents inside of my game.

I believe the PakList file is stored in {EngineDir}\Programs\AutomationTool\Saved\Logs, and it should be called something like Paklist_Project-WindowsNoEditor.txt.

We haven’t even been able to get that to work. The PAK is mounted automatically like you mention, but the asset registry fails to discover the additional content. We’re pretty much at loss here.

We’ve just tried to follow Tom Looman’s tutorial and build a PAK file as DLC. I’m very sure the PAK actually has the assets (I’ve dumped the contents), and no error is provided by the engine after mounting.

I tried following that as well and this was the only way I actually got it to work. He wrote that for 4.9 and it’s possible something has changed since then.

Well, thanks !