I’m trying to instantiate a object that has a script attached to it. I’d like that object to spawn with a public variable that I can change depending on the object, in this case ParticleScale.
Here is my script:
GameObject go = (GameObject)Instantiate (explosion, transform.position, transform.rotation);
F3DParticleScale stop = go.GetComponent <F3DParticleScale>();
stop.ParticleScale = particleSize;
Regradless of the value of particleSize, the script always creates the explosion with a size of 1.
Is this because after the object is instantiated this script no longer has control of the variable? Or did I do something else wrong?