External Plugin Pak File - Asset Registry not being serialized

Hello,

Currently we are working on modding support for Squad, this includes adding support for the Steam Workshop. Right now we are in the stage where we are working on getting mods loaded correctly. Today, I started working on Steam Workshop support for Mods. This included me adding Steam’s workshop directory to the Plugins AdditionalPaths TArray<>.

It seemed like everything was working, the plugin’s pak file got mounted as it normally would; as if it were located in the Squad/Plugins/Mods folder, but when i went to use the content; via our map change command, I noticed that the AssetRegistry was not populated with the mods assets. Please note that only the asset registry is not populated with mods assets when the mod is located in the Steam Workshop folder. When it is inside of Squad/Plugins/Mods everything works correctly.

I then decided to do some digging, and I finally hit the root of the problem:

IPlatformFilePak.h - FPakEntry* Find

Inside of there a check is done:

if (Filename.StartsWith(MountPoint))

And in our case since our plugin is not located within the Squad project. That fails.

Filename : c:/steam/steamapps/workshop/content/393380/TestingMod/AssetRegistry.bin
MountPoint : ../../../Squad/

Since the Find function fails so does FAssetRegistry::FAssetRegistry() when it tries to serialize plugin pak file data (Around line 101 FFileHelper::LoadFileToArray fails).

At this point, i am not sure what to do to fix the issue. Any help we be greatly appreciated.

Thanks,

Zak

Hi Zak,

By AdditionalPaths TArray<> do you mean FProjectDescriptor::AdditionalPluginDirectories?

If you are using plugins (as in there’s a uplugin file, not just a lone pak file) then make sure the plugins are being found in the FPluginManager::ReadAllPlugins function and that they are enabled.

If your plugins are being found by ReadAllPlugins, but the pak file is still not being mounted, then it may be because it can’t find it; or perhaps resolve the content directory within the pak file.

That code is in FPluginManager::ConfigureEnabledPlugin and it’s caller, FPluginManager::ConfigureEnabledPlugins.

Once a package is found it should broadcast the FPackageName::OnContentPathMountedEvent which is subscribed to by UAssetRegistryImpl::OnContentPathMounted and should be the point at which the assets become visible to the asset registry.

Also look in your logs for LogPluginManager and LogAssetRegistry entries which could be a source to find errors in loading your plugins.

Debugging the PluginManager followed by the AssetRegistryImpl would be my next recommendation.

Cheers,

Jonathan

Hey Jonathan,

My PAK file is being found, and mounted. The issue is that the AssetRegistry isn’t being loaded from the PAK file when the plugin is located a file outside of the base Squad folder.

In PluginManger.cpp:

FCoreDelegates::OnMountPak.Execute(PakPath, 0, nullptr);

Is succeeding. Its later on in the program when it gets to the AssetRegistry constructor FAssetRegistry::FAssetRegistry() it fails. Inside of there it tries serialize plugins with pak files paks. And that is where it fails. Referencing above it is failing because our Filename is not in the Squad root project so the

if (Filename.StartsWith(MountPoint))

Fails. Here are the details of the case failure.

Fail Case (This is when it is in the Steam Workshop directory):

Filename : c:/steam/steamapps/workshop/content/393380/TestingMod/AssetRegistry.bin
MountPoint : ../../../Squad/
Succeed case (This is when it is in Squad/Plugins)
Filename: ../../../Squad/Plugins/Mods/TestingMod/AssetRegistry.bin
MountPoint: ../../../Squad/

Thanks,

Zak

Hello,

You’re going to need to manually add the mount points for mods because we don’t have a system that knows how to find them properly. The AdditionalPluginDirectories system works for external plugins, but they are all known at cook time.

They remap themselves into the CookedContent directory so that content plugins have a consistent mount point. You’ll need to do something similar but in a dynamic manner to mount “ModFoo/Content” to “c:/steam/steamapps/workshop/content/393380/ModFoo/”

Thanks,

Joe