Particle System Optimization (.IsAlive but more efficient)


I am currently making a game with a lot of particle systems that need to be in place to allow lots of entities to use them simultaneously. This means that there are about 500 particle emitters in total. I have them running from an object pool to reduce garbage collection, so I disable them after they finish running instead of using Destroy. However, I’ve run into a bit of a problem. Checking whether each particle effect is done every single frame is extremely slow. I have to disable them when they finish because otherwise they cause even more lag than checking every frame. So here’s my question: How can I achieve the same effect without running .IsAlive in Update for each particle? As I said before, I am using object pooling, so I can’t use Destroy (x time) on its creation. I could skip some frames for the .IsAlive checks, but I’m worried that this will only help a little because it’s still running checks every frame (albeit much cheaper ones). I could also run the checks from an overhead script or something, but that would only help so much, and with such a large number of particles, it might be even slower to access their particle systems every frame. Is there a way I could use Unity’s event system here to speed this up, or some equivalent system? Is it even possible to avoid this issue, or am I just going to have to design around it?

Thanks in advance,
The Koala Squad.

How about Unity - Scripting API: ParticleSystem.MainModule.stopAction ? (Can set via the Inspector or via script)