Hello, im new to unity and im making a 2.5d game. What I want to do is emitt a smoke particle effect when a bullet touches an enemy. Sadly Particle effect doesn’t emitt, I dont know what I have done wrong. I hope you understand what I said. Thank you for helping me.
var smokeFX : ParticleEmitter;
var damage : int = 1;
function OnTriggerEnter (Bullet : Collider)
{
if (particleEmitter) {
particleEmitter.emit = true;
yield WaitForSeconds(0.5);
particleEmitter.emit = false;
}
if(Bullet.gameObject.tag=="Enemy1"){
Bullet.gameObject.GetComponent(EnemyBehaviour).TakeDamage(damage);
}
}
Hmm, not really sure what your code is supposed to be doing, but I think what I would do is Instantiate the particle emitter upon something penetrating the Collider.
As in:
//The particle Emitter prefab to instantiate
var myParticleEmitr : GameObject;
function OnTriggerEnter (Bullet : Collider) {
if(Bullet.gameObject.tag=="Enemy1"){
var newParticles : GameObject;
newParticles = Instantiate(myParticleEmitr, transform.position, transform.rotation);
}
}