Particle System Array + Control

Hi Guys,

I want to create multiple particle systems on a single gameobject and enable/disable specific ones according to what state the gameobject is in…

Is there a best practice to this?

I’m guessing I’d want to make an array of particle systems… How would I collect them?

Once they’re named I’m guessing I just set it as ‘MyParticleSystemArray[0].enable false;’… Or something like that… But how would I get a list of all the attached particle effects to the gameobject?

Also on a sidenote there’s no massive problem with having a load of disabled particle effects on an object. It wont have the processor thinking about a load of needless stuff will it?

Thanks guys! Merry Xmas!

Hey, this is probably a little late by now… But here goes anyway!

ParticleSystem[] myParticleSystemArray = GetComponents<ParticleSystem>();
foreach (ParticleSystem ps in myParticleSystemArray) {
  ps.Stop();
}

I wouldn’t worry about performance unless you notice performance problems. And I can guarantee if you have performance problems, it won’t be from having multiple ParticleSystems on the same GameObject!

1 Like

Not too late at all… Thanks Garth :slight_smile: