Reading Array in Niagara Custom HLSL

I am trying to write a Niagara script to read and process the array in Custom HLSL.

This is technically legal:

But when I try to read the input (float) array in the Custom HLSL,
the compiler gives me “(array) undeclared” error.

I Googled all day but couldn’t find any solution at all.

Try like this :

1 Like

Thanks. I got this to work, somehow. When I do this in a scratch pad and set the scratch module in a GPU emitter. However, when I am using it in a CPU emitter or making it a standalone module script asset, the compiler gives me the lvalue (???) error.

I know I can just use the #if GPU_SIMULATION condition, but I am so baffled because the array function nodes work in both CPU and GPU simulations, but not the array commands and loops in custom HLSL? I just don’t understand.

Anyway, thanks for the great help. Also I realized that there is a handy list of array commands with in/out explanations if I copy them to the notepad.

1 Like