1
\$\begingroup\$

In Unity, is is possible to persist emitted particles in a scene after the system has ended or even possibly destroyed?

I have a particle system attached to my player prefabs that does a rudimentary blood splatter, and I'd like for the emitted "blood" particles to stay in the scene for as long as the scene is active, even after the player prefab that originally emitted the particles is destroyed.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

This should do the trick (for the new Shuriken particle system):

Transform PE = transform.Find("exhaustPE");
PE.particleSystem.Pause();
PE.gameObject.parent = null;

The lines below apply to the Unity legacy particle system (version < 3.5):

public ParticleEmitter emit;

// Call this immediately before you destroy your missile
public void DetachParticles()
{
    // This splits the particle off so it doesn't get deleted with the parent
    emit.transform.parent = null;

    // this stops the particle from creating more bits
    emit.emission = 0;

    // This finds the particleAnimator associated with the emitter and tells
    // it not to auto delete the particles.
    emit.GetComponent<ParticleAnimator>().autoDestruct = false;
}

Both code samples are taken from the Unity3D forums (sample 1 and sample 2).

\$\endgroup\$
2
  • \$\begingroup\$ The first solution seems to work, but instead of Stop(), use Pause() to persist the particles. The second solution is for the legacy particle system in Unity, FYI. \$\endgroup\$ Mar 12, 2014 at 21:11
  • \$\begingroup\$ @Neeko I updated the answer with your additional information. Great feedback, thanks. \$\endgroup\$ Mar 12, 2014 at 21:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .