Download

Can I load a custom .Pak file runtime ???

A Pak file whick I use UnrealPack.exe cmd, only pack some materials, texture file etc. Not A Pak of plugin generated through ProjectLaucher.

I look for some code in answerhub but none of them work. I use the AsyncPackageStreamer refered in Mounting pak files at runtime - UE4 AnswerHub

but still crashed. and I code without that plugin, the code as below:

1 IPlatformFile &PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
2 FPakPlatformFile PakPlatformFile;
3 PakPlatformFile.Initialize(&PlatformFile, *args);
4 FPlatformFileManager::Get().SetPlatformFile(PakPlatformFile);

5 FPakFile PakFile(*pakFile, false);
6 TArray<FString> AssetFileNames;
7 PakFile.FindFilesAtPath

I found if I run 4 FPlatformFileManager::Get().SetPlatformFile(PakPlatformFile) . it will definitely cause a crash but not instancely it will still excecute the code and I did find the files in pak in 7
but if i return after 3, it won’t crach…

anyway, is there a standard example of loading pak in runtime? I’ve looked solution for days but it still won’t work…

Yeah, that would be great. I am having exact same situation, I have read all of the topics, checked plugins and contents about dynamic asset loading, with no luck. If I put FPlatformFileManager::Get().SetPlatformFile(*PakPlatform) the next line of code that relates to Pak Mounting crashes. Is there any solution with this?