Disable WorldParticleCollider


How to turn off the 'Send Collision Message' through code? I tried setting the max energy of my particles to 0, but we still have one particle that maintains it velocity and collides with the meshCollider..

Just looking for a way to turn on/off the 'Send Collision Message' through code. This is desired because I really still want to see the stream of particles emit, just 'sometimes' I would like them to not be detected.

I don't see any direct way in the docs to toggle the Send Collision Message programmatically.

What you could do is check a flag as to whether you care to do anything with the collision:


static var ignoreParticleCollision : boolean = false;

function OnParticleCollision (other : GameObject) {
    if(ignoreParticleCollision) {
        //Do stuff with collision...


if(something) CollisionScript.ignoreParticleCollision = true; //turn off
else if(somethingElse) CollisionScript.ignoreParticleCollision = false; //turn on

If you need to do it per object, `ignoreParticleCollision` would not be static and you would need to get the script attached to the object with `GetComponent`:

objectToSet.GetComponent(CollisionScript).ignoreParticleCollision = true;

It's not the same as not sending the message at all, but there's no clear alternative since the WorldParticleCollider seems inaccessible. You could create prefab particle emitters with and without the WorldParticleCollider Send Collision Message set to true and then instantiate/destroy to replace with one with the correct setting, copying the particles over before destroying the incorrect one, but this would incur some overhead and is fairly inelegant.