- Home /
How to pause emitter in new Particle System?
Is there anyway to only pause the emitter instead of the whole system?
I'm using particle system to create weather effects, like snowing and raining, but the problem is, when I pause the particle system, both particles and emitter are paused, so the raindrops and snows are frozen in the mid-air, which is not desirable.
Similarly, stop doesn't work as expected either. When the particle system is stopped, all of the particles are wiped out immediately, instead of waiting for their lifetime.
If I cannot control the emitter, how do I achieve such effect using particle system?
Before you answer, please note that none of these methods works:
Emit() function does not follow the particle system's modules.
Stop(), change emissionRate, playbackSpeed, enableEmission, will kill the particles
Pause() will freeze the particles as I said above
Stimulate() will pause the particles
Particle system will stop if it emits more than maxParticles, so changing it will stop the system
Answer by Kibsgaard · Feb 23, 2014 at 12:46 AM
particleSystem.Stop();
Here that stops the emission and lets the currently active particles live.
Add a Particle System to a game object and this script:
void Update () {
if(Input.GetKeyDown(KeyCode.Space))
particleSystem.Stop();
if(Input.GetKeyUp(KeyCode.Space))
particleSystem.Play ();
}
When you hold space the emitter pauses, while the particles keep flying.
I tried using stop(), it only lives for about one second. Any clue what might be wrong?
Do you mean that the particles only live for one second? Just increase particleSystem.startLifetime.
$$anonymous$$g. increasing their lifetime to 10 seconds:
particleSystem.startLifetime = 10;
The particles only lived for about one second after I called the function Stop(). The startLifetime is about 20 second,which made me so confused why particles disappear...
That is weird. There is no other script disabling either the particle emitter or the game object which it is attached to?
Both particle system and game object are always active in the scene, and no other script is related to them Do note that I'm not using legacy particle emitter, but the new Shuriken particle system.
Answer by MikePauza · Jan 10, 2019 at 03:09 PM
Using Unity 2018.3 on both Mac & PC:
On both the code is automatically changed. It works on PC, but only works sporadically on Mac.