Prefab Particle gets destroyed because its parent gets destroyed, how do I fix it?
Well, I have a problem. I have written a script that shoots spheres in the direction that I'm looking and at least that works lmao And this sphere gets deleted after 5 seconds to avoid lagging, but I have a particle system parented to this sphere and the particle system just cuts off when the sphere is destroyed I just want the particle system to stop emitting NEW particles when the sphere is destroyed, not to delete every particle at once
How can I fix that?
Answer by ifurkend · May 28, 2017 at 04:43 PM
You can't in your setup. As long as particle system is destroyed, all of its emitted particles are destroyed as well. In fact destroy is your last resort when in most cases you can just disable the specific component like mesh filter and mesh renderer to hide the object. Once you need it else where, translate the object position and enable mesh filter and mesh renderer again. This is much more memory-friendly than destroy-instantiate again and again. As for the particle system, assuming you're using Unity 5.5 or onward, use ParticleSystem.Stop() to halt emission which does not kill emitted particles instantly unless specified by a parameter of Stop (this is detailed in the Unity api, just google it).