Hi
I am wondering if there is a simple way through script to turn off or stop all particle systems from running.
I envisage this to be be a quality setting at the start of the game and give the player the option to turn on or off all particles.
The game has already been created, but this was not included as part of the design (ill know better next time!!). Hence why i hope there is a simple scripting way to do this as all the particle systems have already been implemented.
I come from an art background and i am not very c# literate but i am trying to learn, any help or advice would be immensely appreciated.
Thanks
Not that I’m aware of. It depends on how you’ve implemented your particle systems as to what the best way to deal with this would be.
For example, if all the particle systems were just attached to scene objects and active at the start of the scene, you could probably just FindObjectsOfType to get all the particle systems and destroy them all at once. More likely though you’re going to need to in code decide on a case by case basis how best to disable each particle system, such as choosing to not instantiate an object with a particle system attached, or disabling a particle system component when you instantiate an object containing one.
You could also go to all of your particle systems everywhere in your game and disable all of them, and add a script to each one that checks for your particle system enabled/disabled setting, and enables the particle system if it should be enabled.
1 Like
Thanks for reading and replying Joe 
The particle systems are all attached to game objects over a number of scenes. with some being active at the start of the scene and others active later in the scene.
I do have a way of doing this but it would mean going into each scene and manually setting them up to be off if this was selected.
Sort of hoped there was a quick way of doing this so unity would think oh thats a particle system and ive been told not to play them so dont! 
Would the FindObjectsOfType and destroy work on in active particles in the scene?
Again thanks !!!
Why not have a script on an object with DontDestroyOnLoad () and have separate lists in it for all the particle emitters in each scene. Manually drag the preexisting ones into the lists (or do it by code with FindObjectsOfType on scene load) and when new emitters are created add them to the current scenes list. Then when you want to stop or destroy them all check what scene it is and loop through that scenes list doing whatever to them.
1 Like
FindObjectsOfType doesn’t return anything inactive.
Resources.FindObjectsOfTypeAll says it will return inactive, but also pretty much anything, including prefabs, so it might work but might be dangerous if you’re destroying stuff. I haven’t used it, but might be what you need.
https://docs.unity3d.com/ScriptReference/Resources.FindObjectsOfTypeAll.html
1 Like
Thanks for replying joe and quinn appreciate the advice and guidance, the Resources.FindObjectsOfTypeAll does seem like it has the potential to do what i need.
Although not having much time to experiment and see what works, I have gone through all scene files and grouped the particles into a parent game object in each scene called ParticlesOn.
The particles are on by default but when the player selects to switch these OFF I have set a boolean up that records this choice, at the start of each scene a check is done to see if this game object should be de-activated.
I have gone a little further and placed a ParticlesOff game object in each scene so this replaces anything when the particles are switched off.
As an example i have animated rain particles, but if these are switched off a still image is shown with rain which is not moving!
Hope this helps and thanks again for the input 