Download

Is it possible to get all active instances of a particle system?

Basically I have a jetpack system, sometimes, if there is extremely low fuel and user turns on the jetpack and it immediately turns off, what happens is that my sprite-based thruster particle system is constantly left turned on. I used a particle system that has no end life so the only way to turn it off is to use “Destroy Component”. Now the thing is, if the thruster system is turned off before the “spawn emitter” method is able to create the particle, the “destroy component” method will fire before the “spawn emitter” method and thruster particle system will remain turned on.

What I’ve thought of is to store each instance of the particle system in an array and then periodically destroy each instance every time system is turned off.

I really don’t want to edit the code because my jetpack has two modes and both have a vast code with the same spawn emitter system integrated in both. I really want a way to edit the spawn emitter system without having to edit the main code.

I hope you can infer from the spaghetti code attached below. Also, ignore the “late cleanup” method, it’s what I’m trying to replace. That one isn’t working. Instances of the particle system still manage to slip through ALL of those methods to check and destroy.