Hello,
I have this prefab structure :
The “Effect” prefab and its children all have a Partice System.
I want to start or stop the effects from a script.
I tried everything but it does not work :
ParticleSystem[] childrenParticleSytems = currentInstanceOfObject.GetComponentsInChildren<ParticleSystem>();
foreach (ParticleSystem particle in childrenParticleSytems)
{
particle.gameObject.SetActive(false);
// OR
particle.gameObject.SetActive(true);
}
This way, it is OK to deactivate it but if I reactivate it, it does not work.
ParticleSystem[] childrenParticleSytems = currentInstanceOfObject.GetComponentsInChildren<ParticleSystem>();
foreach (ParticleSystem particle in childrenParticleSytems)
{
particle.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
// OR
particle.Play(true)
}
This way, nothing works (stop or play). The particle effect is always up.
What is the correct way to play/stop all my “Effect” prefab ?
Thanks a lot
