Search code examples
unityscriptunity-game-engine

I want to destroy particles by another particles in unity


I am making a game like fire fighter and I had made a fire by particles system , and using fire extinguisher just a prefab, which emitting another particles and iI want when 2nd particles collides with first particles (fire) then first particles (fire) will destroy? Any Suggestions? Thanks in Advance.. :-) I had already tried about particle colliding and some others like

  collision col;
  if(gameObject.name=="Particle")
  Destroy(col.gameObject);

Solution

  • If you attach this script to Water particle, and you have a Fire particle, then in your water collision script

    if (other.gameObject.name=="Fire")
    {
        Destroy(other.gameObject);
        // bonus effect for smoke particles
        // Instantiate(smokeObject, other.gameObject.transform.position, other.gameObject.transform.rotation);
    }