I’ve tried google but couldn’t find an answer. I’m not sure I’m even searching the correct question or maybe it’s a logical error on my part.
I have several effects that play when their respective buttons are pressed. Currently have the same 1 script “PlayParticle” attached to each particle system that will start and stop the effect when the respective button is pressed. I’d like to be able for the script to check if another particle is playing and stop it before playing a new one or create a particle control script to call the respective particle when the button is pressed.
Any ideas on how I can achieve this? Any info or references would be greatly appreciated.
Not sure of your exact use case but I try to stay away from stopping / starting particle system, as it can have lots of edge case issues. Instead I use this approach:
ParticleSystems (particlesystems): emitting in various positions in space (no play / stop):
it’s kind of like a god game where the player can press a button which would play an effect. Ex. Rain button makes it rain, snow button makes it snow. There are about 20 particle effects. Currently, if the player presses the rain button and then presses the snow button, the rain will continue playing along with the snow until the player presses the rain button again. I’d like to have the buttons check to see if other particle effects are playing and to stop it before playing a new one.