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:
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.
Hm, I got here by looking at what might be causing a freeze/slow loading during editor (5.8) startup… The callstack points to Niagara and validating assets in Niagara plugin content, would seem to confirm this…
Index=4014
Time=37.923295s
Verbosity=Warning
Category=Cook
Message=An AssetRegistry query is executing during a package load or save, and it uses an ARFilter with bIncludeOnlyOnDiskAssets=false. This will create cookindeterminism since the packages in can vary between cooks. Caller should set bIncludeOnlyOnDiskAssets=true. For the recorded dependency we are forcing bIncludeOnlyOnDiskAssets=true. Callstack of the AssetRegistryQuery construction:
File=E:/UE_5.8//Engine/Source/Editor/UnrealEd/Private/Cooker/CookAssetRegistryAccessTracker.cpp
Line=176