I’m having issues trying to enable / disable emission from different GameObject in Script. I saw many questions related to mine and the Scripting API and it seems I’m doing it right, still doens’t work. Can anyone help pls?
Here is the code (I’m testing, trying to start emissions on start):
....
private ParticleSystem particle;
private ParticleSystem.EmissionModule em;
....
void Start()
{
particle = GameObject.Find("EnemyShootParticleSystem").GetComponent<ParticleSystem>();
em = particle.emission;
em.enabled = true;
}
I also tried a few things with “Play()” and “Stop()” but it doesn’t work, the particles don’t start emmiting. I don’t get it, what’s the problem?
Note: the “Emission” checkbox is disabled in GUI, since I want to enable / disable in script. I know the recommended way is not via Script, but I need to do it this way (and if it’s possible, it should work).