GPU_SIMULATION and array command

Hi all! why is this code not working? At the same time, if you remove “#if GPU_SIMULATION”, then everything works. The emitter runs on the GPU, that is, sim target = GPUCompute Sim is set in the property. Or is working with arrays in niagara available only on the CPU?

1 Like
  1. You cannot run for loop in either System or Emitter Spawn/Update groups but Particle groups only, at least not in Custom HLSL.
  2. AFAIC, Emitter (System as well) Spawn and Update groups are always running on the CPU side even if the emitter is set to GPUCompute Sim. #if GPU_SIMULATION is specifically for Particle groups only.

In the latest UE 5, Niagara script includes the new array parameter maps including “for” loop node which doesn’t report error when used in System/Emitter groups, so you may give it a shot. I don’t have time to try it properly yet, though.

2 Likes

Thank you! By experiment, I found out that the loop in hlsl in the emitter update groups still works, but only up to 127 iterations, if you set more, the engine crashes

2 Likes

I am not sure if I provided you with enough help, but one thing I’ve just learned is that, even in UE 5.2, Get() is still not allowed in Custom HLSL in System/Emitter groups, whether it’s run in a for loop or not. On the other hand, the Parameter Map “Get” is totally functional in System/Emitter groups.