I’m making an evasion game where you have to evade objects with a ball in a random generated world.
When that ball hits an object, that object has to emit a particle.
But when the ball hits the object , that object doesnt emit a thing.
And when the prefab of that object spawns again the particle is constantly emitting.
this is the code i used to emit the particle
the private var goan gets a boolean from the object (true = collision on object)
private var hitParticles : ParticleEmitter;
private var goan = FlasherScript.ParticleEmit;
function Start () {
hitParticles = GetComponentInChildren(ParticleEmitter);
if (hitParticles) {
hitParticles.emit = false;
}
}
function Update () {
if(goan == true) {
Emitten();
}
}
function Emitten() {
hitParticles.emit = true;
yield WaitForSeconds(3);
hitParticles.emit = false;
}