I have been working on mounting pak files at runtime and recently read here that FCoreDelegates::OnMountPak.Execute could simplify a lot my code and solve one of my problems.
Except that I didn’t find any documentation on this function. And my code doesn’t work :
if (FCoreDelegates::OnMountPak.IsBound()) // returns true
const FString PakFilPath = GetFileLocalPakPath();
FCoreDelegates::OnMountPak.Execute(PakFilPath, 0); // returns true
LoadedMesh = Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), NULL,TEXT(" /Game/BigRoom/placard_cuisine_7/placard_cuisine_7.placard_cuisine_7" )));
It just returns the following errors, just like if nothing had been mounted at all :
[2015.12.10-11.12.48:546][ 7]LogLinker:Warning: Can't find file '/Game/BigRoom/placard_cuisine_7/placard_cuisine_7'
[2015.12.10-11.12.48:547][ 7]LogUObjectGlobals:Warning: Failed to load '/Game/BigRoom/placard_cuisine_7/placard_cuisine_7': Can't find file '/Game/BigRoom/placard_cuisine_7/placard_cuisine_7'
[2015.12.10-11.12.48:547][ 7]LogLinker:Warning: Can't find file '/Game/BigRoom/placard_cuisine_7/placard_cuisine_7'
[2015.12.10-11.12.48:548][ 7]LogUObjectGlobals:Warning: Failed to load '/Game/BigRoom/placard_cuisine_7/placard_cuisine_7': Can't find file '/Game/BigRoom/placard_cuisine_7/placard_cuisine_7'
[2015.12.10-11.12.48:548][ 7]LogUObjectGlobals:Warning: Failed to find object 'StaticMesh /Game/BigRoom/placard_cuisine_7/placard_cuisine_7.placard_cuisine_7'
Does anyone have an idea ?
Is there a way to list all the currently mounted assets ?
In 4.11 there’s a new module called HotfixManager which can download PAK files used to patch your game at runtime (not exe, just BPs, content, etc.) Here’s the code I wrote to mount PAK files:
UE_LOG(LogHotfixManager, Error, TEXT("PAK file (%s) could not be mounted because OnMountPak is not bound"), *FileHeader.FileName);
FString PakLocation = FString::Printf(TEXT("%s/%s"), *GetCachedDirectory(), *FileHeader.DLName);
if (FCoreDelegates::OnMountPak.Execute(PakLocation, 0))
UE_LOG(LogHotfixManager, Log, TEXT("Hotfix mounted PAK file (%s)"), *FileHeader.FileName);
Thank you for your answer, but it looks like your code is very similar to mine :
- You are using a FileHeader (what class is this?) but I don’t see how it can affect the mounting
- “MountedPakFiles.Add(FileHeader.DLName);” is only here to remember which pak file has been mounted, right ? Or some other use ?
- I am using the 4.10 so maybe I am missing something here but I don’t see what. Are you using the HotfixManager from 4.11 that you are talking about in this code ?
Could my error simply be here:
LoadedMesh = Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), NULL, TEXT("Game/BigRoom/placard_cuisine_7/placard_cuisine_7.placard_cuisine_7" )));
Maybe the reference path is updated during mounting with a “Engine/” or something ? Here I assume that the reference is exactly how it was in the original unreal project used to create the pak file.
Note I said 4.11 so I you’ll need that first. It’s in Engine/Runtime/Online/Hotfix
My guess is your path does not match what is in the PAK file. Use UnrealPAK to dump it back out and see if that’s the problem
No that is not the problem either.
I am going to wait for the 4.11 to try the HotfixManager. For now my workaround will do the trick.
Hi, I am having the same problem. Have you figured it out? I generated PAK files manually with UnrealPak.exe but then I have no idea where in my packaged game directories should I put these PAKs, and I don’t know how to implement GetFileLocalPakPath() in your code snippet.
After the PAK files are loaded, how to get the uasset files out from its inside?
How should I specify the path to StaticLoadObject, which in your case is " /Game/BigRoom/placard_cuisine_7/placard_cuisine_7.placard_cuisine_7"
I loaded map from pak file, it can be loaded into the map, but the map of uasset gone, how to load the map with uasset? Thanks. （现在加载出的关卡没有uasset，（没有索引关系），关卡的索引关系在哪儿存放呢？怎么加载可以加载出索引）
Where the heck is this path “Engine/Runtime/Online/Hotfix”?
I can’t find this path in the API documentation. I can’t find it in any engine source on GitHub. If this is online documentation please provide direct links and not a file path description.
Sorry Engine/Source/Runtime/Online/Hotfix. FiF would have found it too. In later releases it was moved to a plugin along with the other online*, so Engine/Plugins/Online/OnlineFramework/Source/Hotfix
Thanks for the quick response. I have a connected question to this one. Should I just open up a another topic or append it here? It relates to mounting PAK files as well but it involves an unusual use case. FWIW, it’s been suggested I identify as being from Missing Worlds Media, Inc. due to our contract with Epic games.
You should ask on UDN then.