Using particle attribute reader crashes the engine

In the repro project, simply drag the niagara system N_ReaderCrash in the map

Open the system and enable Get Source Position module

[Image Removed]

The module simply tries to read the position of the source particle using ID provided by Spawn Particle From Other Emitter

[Image Removed]

As soon as we enable the module, unreal will crash.

Also seems to be crashing only while using GPU emitters, working fine using CPU.

Steps to Reproduce

  • Create a new niagara system
  • Have a source emitter and an other emitter that uses spawn from other emitter module
  • Try to read any data from the source emitter using particle attribute reader

Hi Yan,

Thank you for the report and for providing a minimal repro project, that is extremely helpful.

I was able to repro the crash here and do some additional experiments. It seems that the Editor is not properly handling the situation where a reference to a Particle Attribute Reader gets duplicated and passed around between Niagara modules in certain ways. In my tests, the following pattern sometimes results in a crash, and sometimes leads to incorrect data being read in the Particle Update stage:

Emitter Spawn Stage -- Module has Attribute Reader input, gets it inline and stores it as an Emitter attribute A

Emitter Update Stage -- Module has Attribute Reader input, gets it from the Emitter attribute A, and stores it in another Emitter attribute B

Particle Spawn Stage -- Module accesses the Emitter attribute B directly

Particle Update Stage -- Module has Attribute Reader input, gets it from the Emitter attribute A

Also, in my tests, everything seemed to work correctly when the input for the module in the Particle Update Stage was changed to use an inline Attribute Reader, or to use the one from Emitter attribute B instead of A (the one that was set by the Emitter Update Stage instead of the Emitter Spawn Stage). In your example, this workaround means:

  • Change the “Trail” emitter sim target to “CPU Sim”
  • Enable the “Get Source Position” module
  • Change the input “Particle Attribute Reader” to “Emitter.SpawnParticlesAttributeReader” instead of “Emitter.SourceReader”
  • Change the emitter sim target back to “GPU Compute Sim”

I am gathering some more information now and preparing a bug report for the engine devs. I’ll get back to you soon with a tracking number for it!

Let me know if there is anything else I can do to assist you.

Best regards,

Vitor

Hi,

Thanks for the quick answer. I can confirm that the workaround is working, using the attribute reader output from Sample Particles from other emitter instead of the one defined in the emitter spawn stage avoids the crash.

Best,

Yan

Hi Yan,

Sorry about the delay getting back to you with a bug tracking number. Here it is: UE-350887. The link should become accessible when the engine devs mark it as public.

Best regards,

Vitor