This works in editor and packaged build. However in a packaged build I’m only able to get Blueprint-Actors that are part of the main-pakfile. BlueprintGenerated actors from the runtime mounted pak are not returned from the asset registry. I opened the created .pak to make sure the BlueprintClasses are inside.
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(FName("AssetRegistry"));
IAssetRegistry& assetRegistry = AssetRegistryModule.Get();
if (assetRegistry.IsLoadingAssets() || bScanPath)
{
TArray<FString> pathsToScan;
pathsToScan.Add(*path);
assetRegistry.ScanPathsSynchronous(pathsToScan, true);
}
FARFilter filter;
filter.bRecursivePaths = bPathRecursive;
filter.bRecursiveClasses = true;
filter.PackagePaths.Add(*path);
// Note: assetClass->IsInBlueprint() returns true, if the class was implemented in blueprint.
// It will return false for classes that are native, like AActor.
if (bBlueprintClass)
{
filter.ClassNames.Add(UBlueprint::StaticClass()->GetFName());
}
else
{
filter.ClassNames.Add(*assetClass->GetClass()->GetName());
}
TArray<FAssetData> assetList;
assetRegistry.GetAssets(filter, assetList);
assetList does not contain the actors from the mounted .pak, they are not known to the AssetRegistry.
Hey Rumbleball, we’re trying to get mod support to work over here and face a similar issue : no DataAsset object we looked for was ever found by Asset Registry, though our valid PAK file was correctly mounted. DataAssets are basic UObjects, I have no idea if they’re closer to Blueprints than they are to other resources. I’ve seen your answer and I’ll definitely try it out, but this seems like an engine issue.
As long as you do not get anything, I would not assume you mounted correctly. Make sure the MountPoint in the package is correct …/…/…/GameName/… and you mount it to that mount point. In case you package from a different project (Different project name) you need to change the GameName in the mount point.
After that you should be able to get the assets via the asset registry.
This is valid for things links Materials, StaticMeshes, … All assets that do not define a class.
Also make sure you actually mounted. Mounting a .pak is only possible in packaged game (Shipping/Development/Debug).
I had trouble letting unreal mount the PakFile automatically by placing it in the Content/Paks folder of the packaged game. It simply did not work out for me. (UE4.19)
We are getting the PakPlatformFile here the engine already puts into the PlatformFile-Chain. The name of the PakPlatformFile is PakFile. You should not change anything about this line.
if (!PakPlatformFile->Mount(*PakFileName, 0, *PakFile->GetMountPoint()))
{
FLOG("Failed to mount PakPlatformFile");
}
else
{
FLOGV("Mounted PakPlatformFile %s at %s", *PakFileName, *PakFile->GetMountPoint());
}
You are not mouning a PakPlatformFile. You use the PakPlatformFile to mount your PakFile.
Instead of doing that stuff manually, you can also use:
I’ve reverted the offending line, with no change. I’ve also tried the OnMountPak approach with exactly the same result - Pak mounts fine, all files present, no errors, still nothing found through AssetRegistry.
Basically my take here is that AssetRegistry is simply unable to find mod content at all. Did you get that in particular to work ? Or are you using something like SynchronousLoad instead ?
Ive also been attempting to mount with
OnMountPak.Execute
But it always says “Warning: Pak “TestPak.pak” does not exist”
However the directory’s appear to be identical if i auto load it by placing the pak in the content folder, or passing the directory to it. Both show as “…/…/…/Helios/Content/Paks/TestPak.pak” in the log