Niagara Shader Module Delegate Never Set

Interesting find. I’ll see if I can reproduce the crash in “Development” standalone.
By the way, any idea why this error only occurs for GPU emitters, and not for CPU emitters? It might be the case that we’re having the same error for different reasons.

I am absolutely not an expert in Niagara or unreal’s memory management :slight_smile: That said it looks like the NiagaraShader module where this occurs is built for interfacing some data with the GPU, so my guess is CPU emitters might not try and register with this module?

I can confirm that using soft references on GPU Niagara systems fixes the issue. I spent entire week reworking every instance of particle spawning to make it work, and it does, so thank you, CraveTheGrave, you saved my project!
Despite countless tests, i still cannot replicate the issue in fresh project.
Also, issue persists in UE5.

Hey,

We should have a workaround for this in 4.27.2 (Unreal Engine Issues and Bug Tracker (UE-129880)).

Due to this being a load order issue, the workaround is not ideal as it involves having to start up the Niagara module when the delegate is not bound. In the projects I have tested this has been fine.

Here is the code change.

UNiagaraDataInterfaceBase* INiagaraShaderModule::RequestDefaultDataInterface(const FString& DIClassName)
{
	if (!OnRequestDefaultDataInterface.IsBound())
	{
		UE_LOG(LogTemp, Log, TEXT("OnRequestDefaultDataInterface is not bound when requesting default data interface '%s' attempting to load module."), *DIClassName);

		EModuleLoadResult LoadResult;
		FModuleManager::Get().LoadModuleWithFailureReason(TEXT("Niagara"), LoadResult);

		if ( !OnRequestDefaultDataInterface.IsBound() )
		{
			UE_LOG(LogTemp, Fatal, TEXT("OnRequestDefaultDataInterface is not bound when requesting default data interface '%s'"), *DIClassName);
		}
	}

	return OnRequestDefaultDataInterface.Execute(DIClassName);
}

Thanks,
Stu

It may not even necessarily be a Niagara system. In my case the default, automatically generated GameMode was trying to load a character blueprint that was no longer being packaged with my game (the ThirdPersonCharacter blueprint).

This solution helped me find the cause of the problem, thank you!