I want to disable the ParticleRenderer attached to GameObject(Ball1) in script.
ball1 = GameObject.Find("Ball1");
ball1.ParticleRenderer.enabled = false;
that second line gives an error. How do I do this. Thanks
I want to disable the ParticleRenderer attached to GameObject(Ball1) in script.
ball1 = GameObject.Find("Ball1");
ball1.ParticleRenderer.enabled = false;
that second line gives an error. How do I do this. Thanks
Using GetComponent works:
ball1 = GameObject.Find("Ball1");
ball1.GetComponent(ParticleRenderer).enabled = false;
If you're using #pragma strict or on the iPhone, you'll need to cast it as a Renderer:
(ball1.GetComponent(ParticleRenderer) as Renderer).enabled = false;
Depending on your setup, you could instead disable the ParticleEmitter:
ball1.particleEmitter.enabled = false;