- Home /
Particle effect spawn help
I have wrote this script that is attached to my enemy, I have another script attached to my gun that shoots raycasts that if hit the enemy, takes of health. I am now trying to have a particle effect spawn when the enemy dies, I have almost done this apart from my particle effect doesn't spawn where the enemy has died, can anyone help me?
var health = 100;
var death : ParticleEmitter;
function Damage(dmg: int){
health -= dmg;
if (health <= 0){
Instantiate(death);
Destroy(gameObject);
}
}
Answer by FLASHDENMARK · Jul 22, 2012 at 02:37 PM
var death : Transform;
//Instantiate takes 3 arguments. Object, position and rotation.
Instantiate(death, transform.position, transform.rotation);
Use the scripting reference for stuff like this.
Your answer
![](https://koobas.hobune.stream/wayback/20220613074533im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
shooting an enemy with particles 1 Answer
Can anybody help me fix this wave spawning script please? 1 Answer
Need help with enemy spawner 2 Answers
Simple enemy kill count 1 Answer