Niagara: Problem with Particle ID synchronization during spawning

Hi everyone, I have a question for the Niagara experts here :D.

I have a similar setup as outlined in this tutorial: https://www.reddit.com/r/unrealengine/comments/18lldjh/ever_wonder_how_to_set_an_array_of_world_spawn/

To quickly summarize: I have a Niagara system that spawns particles at certain locations based on an array of Vectors that I pass to the Niagara System at runtime.

Particles are then spawned by iterating through the array and taking the last array element to set the position for the newly spawned particle (Details are in the video).

It does work quite well however in contrast to the tutorial shown, I have persistent particles that should remain in the world until I decide to delete specific particles. As such it is important for me to keep track of the correct Particle ID and its location. To do that I have a TMap that maps the Position to the ID. Since I am using Persistent IDs on the particle I can nicely track the Particles in C++ code.

The system works as intended if I spawn particles one by one or in small numbers. Imgur: The magic of the Internet The Particle IDs increase from left to right in rows (since I spawn the particles in a grid)

However If I pass a large array of let’s say > 500 or 1000 particles (I don’t know the exact number where it happens), the system seems to break down and the particle IDs are mixed up. It appears that the spawning of the particles occurs in batches.

Imgur: The magic of the Internet Here you can see that the first four rows are spawned correctly (Particle IDs increase correctly) but the fifth row shows a sudden jump in the particle IDs. After the jump, the IDs increase correctly but the jump messes up the tracking of Particle IDs in my code. All the Particles were spawned from one array so in theory, it should continue incrementing the Particle IDs just as in the first four rows.

I already tried changing a few settings in my Niagara system but that did not help.

I enabled CPU simulation instead of GPU sim (Apparently my setup does not work with GPU sim. I don’t know why and still need to check this). I tried setting the tick rate of the system to fixed to align it to the Gamethread and to not make it async. (Honestly, I don’t like this so much since I think I am losing some performance.)

Does anyone have any ideas on how to get this working? I do have a workaround where I spawn one particle per frame but then the spawning takes forever if I have a lof of particles.

Hope someone has any suggestions:=) If needed I can provide more details!