Download

Niagara duplicated resources cook issue

Hi

I’m observing that UNiagaraScript::LoadedScriptResources array contains several exactly the same resources in the cooked build. Only one resource in used, other remains in the memory and it look like a leak.

I have tracked it down and found that “evil” starts during the cook in the UNiagaraScript::BeginCacheForCookedPlatformData. There is no check if resource has been already cached.
I assume BeginCacheForCookedPlatformData can be called several times for the same UNiagaraScript instance during the cook. Is this assumption correct?

I’m observing the issue in 4.22.3, however source code looks the same in 4.23.1 as well.

Quick fix I made is very simple, inside UNiagaraScript::BeginCacheForCookedPlatformData I have just added:
if (CachedScriptResourcesForCooking.Find(TargetPlatform))
{
return;
}

Anybody observed similar issue or is it already tracked somewhere?