ParticleEmitter

public var ParticleEmitter : GameObject;

function OnCollisionEnter( collision : Collision )

{

if (collision.gameObject) {

ParticleEmitter.particleEmitter.emit = true;

}

}

how to make that particles emit only when collision is detected?

You should call your P.E. particleEmitter (start lower case) so as not to confuse it with a class of that name.

What you have should work, and you can actually remove the ‘if’ test. You would want to initialize the emitter to emit = false. If you want to turn it off when the thing is no longer colliding, implement OnCollisionExit() and set emit to false. If you want to emit when a particular object is colliding, check collision’s name or tag to see if it’s the one you want, and act accordingly.