Niagara System Compilation During Cook Triggers Unsolicited Package Messaging

Unreal Engine 5.6 introduced the: “Unsolicited package X was loaded by package Y. This is a hidden dependency, causes poor cook performance, and it might be a bug to add it to the cook. Declare this package in the AssetRegistry dependencies of the loading package, or mark up its load with FCookLoadScope to specify whether it is runtime or editoronly.” messaging to cook logs.

However, the `FNiagaraEditorModule::RequestCompileSystem` called via `UNiagaraSystem::BeginCacheForCookedPlatformData` should a Niagara System require compilation at cook time, calls:

`ParameterCollectionAssetCache.RefreshCache(!FUObjectThreadContext::Get().IsRoutingPostLoad /*bAllowLoading*/);`

This in turn force loads all Niagara Parameter Collection assets, or with CL 45429441 from //UE5/Main/ force loads all Disk Niagara Parameter Collection assets.

Since this is not tagged with an `FCookLoadScope` this triggers the Hidden Dependency Messaging, regardless of whether the Niagara System that is being compiled is using any Niagara Parameter Collections.

What is the preferred Epic solution for this? Should this load call be scoped as `ECookLoadType::EditorOnly` as compilation of Niagara Systems can only take place in Editor and not at Runtime? Will this behave appropriately if a Niagara System is in fact using Parameter Collections?

We’re slowly resolving these messages (and in some projects have just silenced them as they can be quite noisy), so I haven’t really started to deal with them yet. I imagine that we’ll likely add an EditorOnly scope around the compilation section, but then we’ll also need to add a runtime dependency for the actually referenced NPC when we save the scripts. I should be able to dig into this more in the next couple of weeks.

It’s possible that I might be able to get something in for 5.7, but I can’t commit to that. So definitely for 5.8, but maybe for 5.7,

Would any potential fix be put into 5.7? Or even later than that?