Issues with niagara scratch pad module : "map for" node not woking with CPUSim and "Custom HLSL" array undeclared

Hello, I have 2 issues with niagara scratch pad module.

First :
If if I set the emiter Sim Target to “CPUSim” the “map for” node in scrath pad modules doesn’t work, but if I set the emiter Sim Target to “GPUCompute Sim” it does.
MapFor
I have no error, it just doesn’t loop.
I need my particles to collide with some colliders in my scene so I need to use CPU Sim…

Second :
Since map for didn’t worked, I tryied to use the “Custom Hlsl” to loop my array.
But if I link an array (like a float or vector array) to the “Custom Hlsl” node I have an error that say that the variable isn’t declared.


Is it not possible to pass arrays to the “Custom Hlsl” node, or am I doing it wrong?

Does someone have a solution/explaination to either of those issues?
Thanks.

1 Like

Loops are not yet supported on cpu simulations.

1 Like

hi, could you please show some examples of how to use the MAP FOR node in Niagara ScratchPad? Thank you.

Here is an example setting array elements in a loop

1 Like

@Michael.Galetzka , could u please show an example of adding element onto the totally empty array. Is it possible? And if it is not very hard to u, one example with HLSL … Thank u very much :blush::pray:

@Michael.Galetzka, Is there a way to get the Map For node to work for a System or Emitter Module? It seems to only run through the loop once in those cases.

I did get it to work for Particle Spawn and Particle Update thanks to your help.

No, the map for node does NOT work in cpu scripts. Both emitter and systems scripts always run on the cpu.

The map for node only works correctly in particle spawn/update scripts or sim stages in a gpu emitter.

2 Likes