Iterating through array inside niagara

I’m trying to do something, that feels like it should be simple, but i’m struggling with it.
I want to give an niagara system an array with points, and want an emitter to place a particle at each point.
Giving the system the points is not the problem, but i can’t figure out how to iterate through the array to get every position.
Using a parameter in niagara as an iterator doesnt seem to work as easy as is should.
Basically, what hinders me is the fact, that parameters i niagara seem to be very limited in where they can be read and written.
Maybe i’m missing something, but it would be great, if someone knows how to iterate through an array inside niagara.

The update section of the emitter runs every frame for every particle. So I’m thinking looping on top of that doesn’t make sense.

If you give them unique IDs ( spawn option, I think ), you only need to write the code for one particle, the rest happens automatically.

Honestly, i’m not exactly sure what you mean.
Maybe because i’m new to niagara.

Anyway, i found a solution, that seems to work for me.
Maybe it will help other people struggling with this.
Use “Select Vector From Array” and in “Array Sampling Method” choose “Direct set” and “Generate Int from Counter”
The Counter will now be incremented, every time this part is used. (In this example, every time a particle is spawned)
There seem to be some limitations, though.
For example, you cant set the counter at will.
Also maybe a bug? It seems the counter is incremented BEFORE i gets the value from the array.
Which means the first value stored in the array is being skipped.
Luckily, in my case, i can work around that by setting the “direct array mode” to wrap.

Note:
Clamp: If the counter reaches the end of the array, the counter will continue to point at the last element.
Wrap: If the counter reaches the end of the array, it will be reset to zero.

Maybe there are ways around these limitation, that i’m not aware of.

1 Like