VR Packaged Game Crashing: Niagara Shader Module Delegate Never Set

After packaging my VR game and opening it, it instantly crashes with this error:


 Assertion failed: OnRequestDefaultDataInterface.IsBound() [File:D:/Build/++UE4+Licensee/Sync/Engine/Plugins/FX/Niagara/Source/NiagaraShader/Private/NiagaraShaderModule.cpp] [Line: 55]
Can not invoke OnRequestDefaultDataInterface. Delegate was never set.
 

My game works perfectly fine in the editor with niagara effects in game. I recently upgraded from 4.23 to 4.25 Preview. Does anyone know where I can find some information regarding this?

I have this exact same error, (non-VR) and the issue only occurs when I have Niagara system objects referenced by my actors or data tables. I can spawn niagara systems in Level Blueprints, place them in levels, but put any non-trivial Niagara system as a reference to spawn an emitter and BAM crash on packaged game.

This issue isnā€™t present on non-packaged builds. Iā€™m on 4.24.3 and this is really painful. I run a source-build of the engine and Iā€™m open to modifying the code just need a hint as to why this error is happening!

Apparently if I make the emitterā€™s CPUSim instead of GPUComp Sim there isnā€™t an error when running a packaged version. Unfortunately this doesnā€™t happen in a simple template project so it seems unlikely anyone will be able to investigate this.

Thanks for your response. That was indeed the fix for me as well. Seems very strange that CPUsim fixes it though.

We are also having this problem here on 4.24.1 - We have set all effects being referenced to be CPU sim although not ideal for performance and have set fixed bounds to true. We have made sure Niagara is correctly added to the Build.cs Module Dependencies but alas still have this crash on launch of built version of the game. This is getting really costly in terms of our developement time and is stopping us from progressing on the PFX front. Any help past what has been mentioned above would be amazing! Iā€™ve posted an image of our crash even though its identical to the one above.

unknown.png

Same error here, 4.25.4 :frowning: But CPUsim Fix worked.

Still happening in 4.26.1 !

also in UE5 early access too!

In UE4.27.1 also. Setting all emitters to CPU is not really an option. Iā€™m quite curious to find out why this is crashing.

Just in case it might help anyone else: For some reason this was caused by the gamemode trying to load the player pawn by default. Iā€™ve just uncommented these lines in my gamemode.cpp and that fixed it for me. I assume it has something to do in which order Niagara + Pawn are loaded etc.
I stumbled upon this running the game via Visual Studio, with the Local Windows Debugger attached. Similar to what was suggested here by ā€˜Scapiorā€™:

1 Like

Just following this up in case some other lost soul finds their way here: Tobiasā€™ solution worked for me as well, but UE4 makes the cause of this issue a bit deceptive.

I additionally followed CraveTheGraveā€™s solution here: https://answers.unrealengine.com/questions/953089/niagara-shader-module-delegate-never-set.html

Unreal pretends itā€™s a Niagara issue, but it is not. Additionally, the code in the screenshot above is located in the automatically generated GameMode class that UE4 created for you upon project creation, which isnā€™t necessarily the GameMode class youā€™re actively using. Launching the project through Visual Studio following the steps CraveTheGrave helped me diagnose the problem and find that code listed above.

The Problem:
In the case of Tobias and I, the issue seems to be UE4 trying to load an asset that is not packaged with the project. In my case, it was trying to load the ThirdPersonCharacter thatā€™s provided by default (which is no longer packaged with my game).

The Solution:
Go to the GameMode class that UE4 automatically created for your project, for example MyProjectGameMode.h (it should be at the root of your projectā€™s source folder), and either comment out that entire constructor (like Tobias did), or replace the path to a pawn thatā€™s packaged with your game.

Hereā€™s an example of what mine looks like (be sure to change the ā€œTEXTā€ part to point to a pawn in your own project. I made mine point to an empty pawn blueprint I made):

AMyProjectGameMode::AMyProjectGameMode()
{
	// set default pawn class to our Blueprinted character
	static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("Blueprint'/Game/Blueprints/Characters/EmptyPawn.EmptyPawn_C'"));
	if (PlayerPawnBPClass.Class != NULL)
	{
		DefaultPawnClass = PlayerPawnBPClass.Class;
	}
}

NOTE: If you do change the path to point to a blueprint class, be sure the extension ends in ā€œ_Cā€. Otherwise UE4 will say it could not find the file. ā€œCopy Referenceā€ does not do that for you.

1 Like