- Home /
Question by
AyooNisto · Dec 09, 2013 at 06:38 AM ·
c#javascriptprefabparticle
Particle Effects On A Prefab
I am making a campfire that plays a particle effect that looks like a a fire when the player walks up to it and hits the "E" key. My problem is that i want to make numerous campfires around the map using a prefab but when i do this the particle effect only works on one of my prefabs. Is there a way to make all of the prefabs work with the particle effect.
Comment
have you tried attaching the particle effect to the prefab i.e making it a child of the prefab and then saving as a new prefab
Answer by StormSabotage · Dec 10, 2013 at 01:01 PM
If you will use tagged prefab (for example "campFire"), you can stay that way:
if(Input.GetKey(KeyCode.E)){
GameObject[] campFires = GameObject.FindGameObjectsWithTag("campFire");
foreach(GameObject fire in campFires){
fire.particleEmitter.emit = true;
}
}
that will turn ON all your campfire particles in current scene.
Your answer
![](https://koobas.hobune.stream/wayback/20220613123744im_/https://answers.unity.com/themes/thub/images/avi.jpg)