I created an object that has a script attached to the top most empty game object with a light and particle system childed beneath it. It looks like this:
EmptyGameObject(script is here)
->ParticleSystem
->Light
I then made a prefab of this and placed several in the scene. For some reason the script seems to only be affecting the last prefab I put in the scene. Does anybody know why?
I'm having a hard time understanding what the difference is. I would have to use GameObject.Find() in order to get an object to call GetComponent() on. So I would run into the same problem, I would think.
//////////////////////////////////////////////////////////////////////////////////////////
private GameObject flameEmitter;
private GameObject flameLight;
// Use this for initialization void Start ()
{
flameEmitter = GameObject.Find("CandleFlame/flame1");
flameLight = GameObject.Find("CandleFlame/candleLight");
}
// Update is called once per frame void Update ()
{
Particle [] flameParticles= flameEmitter.particleEmitter.particles;
}