destroy single particles?

I found the same question asked in 04' 13 years ago with no answer. I have a bomb graphic that drops from the air. After 3 seconds it explodes ( destroy(); ) and a particle effect is created with 10 particles that have have a material attached that is shrapnal png image. This then rains down holy hell on the town below. When a particle collides with an object the delegate method is called and I want to destroy this 1 single particle.

void OnParticleCollision(GameObject other){
        print("Particle hit!");
        Destroy(other,0f);
    }

But the destroy is destroying the entire particle system, not just the one particle. Can you destroy just one since particle on collision?

2 Likes

You don't need script for this. Enable "Collision" module in particle system and set "life loss" to 1, change the layers in "collide with" and your object to destroy the particle so the particle only collides with collider of specific layer.

31 Likes


I spent my whole Saturday, 8 hours so far researching this and 30 seconds after reading your answer I see the individual particles being deleted as they hit the gameObject. Thank You!

1 Like

Is it possible to change the value of the particlelifetimeloss per layer, for example: on the player the particle like "destroys" immediately, but on the ground they stay a little longer?

1 Like

No, sorry, we don't have anything built-in for this.

thank you for replying tho

1 Like

Hello, well, I think you could use Trigger together with the Collider. So, you enable the Collision normally, but when it hits the Player, you use the Trigger module (built-in with the particle system) and tell them to kill this particle.

1 Like

Is there a way of making a particle damage the player and then destroying that single Particle by using the Triggers Component and a script? And how do I even destroy a single Particle from a script?

If you set the particle age in the OnParticleTrigger callback you can kill the particle.

1 Like

@ifurkend please can you tell that , is it optimized for mobile games . like modern combat 5 game .


The same thing happened to me, I spent 3 hours trying to figure it out and then i read this! (: thanks

How to destroy one particle (such as fire) with collision or trigger of other particle (such as water).

You can destroy all particles like this:

public void DestroyAllParticles(ParticleSystem ps, bool stop = true)
    {
        ParticleSystem.Particle[] particles = new ParticleSystem.Particle[ps.particleCount];
        ps.GetParticles(particles);
        int count = ps.particleCount;
        for (int i = 0; i < count; i++)
        {
            particles[i].remainingLifetime = 0f;
        }
        ps.SetParticles(particles);

        if (stop) ps.Stop();
    }
1 Like