Niagara crash on boot packged project

Hello everyone. I ran into some trouble trying to add a NiagaraSystem to my project. Basically everything appears to be working in editor but as soon as I package my build the app crashes on launch. Bear with me as I explain:

  1. Try to spawn a NiagaraSystem when a bullet hits a wall. Runs in editor, packages build, crashes on packaged game launch. In this example I’m using a default explosion system just to simplify things –

270330-1simpleexplosiontemplate.png

The crash:

270331-0theerror.png

  1. If I edit my code to the following, package my game, run the packaged game - success. No crash on boot. (no particle system either)

270332-2without.png

  1. Throw the particle system in a level, (putting the system on loop so I can see it.) Compile, package, run packaged game - no crash in the packaged game, everything is fine.

270337-3ineditor.png

Here are my logs:
[link text][5]

I think you just can’t package a c++ game with niagara yet.

Here are some steps to reproduce:

  1. Make a new C++ FirstPerson template project

  2. Enable the Niagara & Niagara Extras plugin

  3. Create a new NiagaraSystem (SimpleExplosion)

  4. Open FirstPersonCharacter blueprint, add an EventTick, add a SpawnSystemAtLocation (use get actor location), Select SimpleExplosion from step 2…

  5. Package game (I use project launcher – here are my settings for the project: Build Config: Development & Build UAT: true, Cook By the Book (select WindowsNoEditor), Cook Maps: FirstPersonExampleMap, Package: package & store locally, Deploy: Do Not Deploy

  6. Open the game & See the crash…

Tested on 4.21.0 & 4.21.2

(If you use a blueprint project btw, in step 1, everything works)

Same here. C++ project with niagara crashes packaged build

In Engine/Plugins/FX/Niagara/Source/Niagara/Public/NiagaraTypes.h ~line 443 it’s this line that crashes, the CastChecked<UScriptStruct>(Struct) part. The Struct variable is null here.

Ah! Good, thanks for the sanity check. I’m surprised more people aren’t having this issue.

Hey! Just in case anyone stumbles onto this who’s using UEngine <= 4.21; Cultrarius on the Epic Team informed me that this will be fixed in the upcoming 4.22 Release.

hi, i have the same problem but in 4.22.1. But when we want to spawn niagara system at location and close the editor and restart it , It craches.

4.22.3, same issue when I set a Niagara bool variable from a C++ constructor.

Hi all, would like to clear up some confusion about this issue, currently tracked here: Unreal Engine Issues and Bug Tracker (UE-71147)

Currently UE4 loads the GameModeBase of a cooked project at a stage before any Plugins are loaded. If your project’s GameModeBase hard references any UClass which itself may be hard referencing a Niagara asset, the Niagara asset will attempt to load before the Niagara plugin has been loaded which results in this cryptic error. (For more about “hard” and “soft” references, please refer to the documentation on asset references here: https://docs.unrealengine.com/en-US/Programming/Assets/ReferencingAssets/index.html)

To give a common example, if your default GameMode hard references your default Actor/Pawn, and your default Actor or Pawn hard references a Niagara System, you may experience this issue.

A resolution is in the works, but for now it is possible to work around this problem in content by loading your Niagara assets through soft object paths when needed. Please refer to this answerhub post for an example. Workaround For UE-71147 - Programming & Scripting - Unreal Engine Forums

Have you found a solution to this problem? We’re encountering the same issue if our pawn owns a UNiagaraComponent that is constructed in the constructore. If we remove the ConstructorHelpers for said component everything works in the packaged build. Well… Everything except that overridden parameters are not taken into consideration and therefore our mesh reproduction isn’t working anymore. Only in the packaged build though. Everything works in the editor exactly as intended…