Yeah that’s a good idea. I might do the same once I finish this contract because I think it would be really cool to write a plugin that handles this stuff for you. Or at least document how it’s done because there is no information. That’s why I wrote that step by step up there so I don’t forget lol. I imagine it’s a pretty requested feature. someone sent me information about using the OnMountPak.Execute() so im going to give it a shot now.
Holy ■■■■, I took out all of that mounting stuff and this worked. So how would you handle a user downloading this information? Would you zip up the “DLC” project and then have the game at runtime download that zip file, unzip it, and mount it like this? Instead of using pakfiles?
Okay, so here are the steps I’m doing which I got from [someone else (mfish’s comment on the first answer][1]).
- Package the PakSource project using the editor.
- Locate the PakList.txt file in UE4 appdata
- In cmd, run
UnrealPak.exe "D:\Paks\test.pak" -Create="path to that PakList.txt file" - That will generate the pakfile and store it in “D:\Paks”
LoadMap function
bool AMyPawn::LoadMap(const FString& levelname, const FString& mountPoint, const FString& mountPath)
{
FString ln;
if (mountPoint.Len()>0 && mountPath.Len()>0) {
FPackageName::RegisterMountPoint(mountPoint, mountPath);
ln = levelname;
}
else {
ln = levelname;
}
FName level(*ln);
UGameplayStatics::OpenLevel(GetWorld(), level);
return true;
}
Calling
LoadMap("■■■■■■", "/Game/", "D:\\paks\\");
Gives me this output in the logfile with a crash: SearchForPackageOnDisk took 0.015s, but failed to resolve ■■■■■■.umap.
(■■■■■■ is the name of my map, i apologize for the profanity but it’s been a really frustrating week haha :D)
[1]: Loading Map from Pak at Runtime - Programming & Scripting - Unreal Engine Forums
■■■■, I have no idea where to do that either…
Yeah there’s actually quite a few benefits to doing it that way (yes that’s the procedure) - you can share assets with a base project and just merge them in meaning much smaller transit files - and compression/decompression will be a lot faster - it also means you’re only comp/decomp’ing once…
@RichardB have you used the pak file compression? It works pretty well on my data sets (json files, pngs, jpgs) and means you don’t need to add any zip decompress tech across your different platforms.
@TestyRabbit … you mean you took mounting code out of the code I shared? Any chance you could share your final solution and tell me what you removed to fix what cos I’ve got to admit I’m not quite following the chronology of this thread!
Yeah I used that first, but I was having to embed the data into multiple BMP files so I could add them to slides in powerpoint files - it was less cpu work to just zip assets one by one and it was windows only. I want to go back to pak files though as yeah I like the transparent compression and now 4.19 has encryption too…
@theonecalledtom I’d be happy to share my final solution with more depth once I fully understand it haha. The only thing I’m having an issue with now is that when I mount a pak that contains a blueprint that’s parented to a c++ class, it fails to load saying Missing Dependency, request for CPPParent but it hasn’t been created yet. Have you ran into this?