Keep remaining particles alive after disabling particle component

Hi,

I have a very basic GameObject that has a particle effect on it, sort of guns that keep firing.
i’ve added support for a fire button (left mouse button) that when its pressed the GameObject becomes Active and then of course it starts firing, but when the mouse button is let go the GameObject becomes Deactivated and the guns stop firing.

its working great, but what i’ve noticed is that if i press it for 2 seconds a lot of particles go out and as soon as i let it go and its becoming disabled, instead of just “stop firing new particles” , all the ones that i’ve shot out disappear instantly… im aware this is because i’ve disabled it, but is there a way i can keep the particles that are already “outside” on till they die or hit something?

it looks really weird that they suddenly just disappear…

Thanks in advance,

The only way I know of is not to disable the gameobject.

Instead, use the Stop function on the particle system. It has a parameter to keep existing particles alive.

2 Likes

@richardkettlewell thank you! :slight_smile:
I’m a starting dev, i didnt think about that, and it works like a charm!

it didnt work at first, with a small google i found that since its running every frame i should be checking if its already playing, so using isPlaying before makes it work gret.

Thanks again for the response (and the response speed!)

1 Like