- Home /
Particle System fails to emit() after last particle dies
Version of Unity: 5.3.1f1/p1
I have a particle system that needs to emit bursts of particles on irregular periods, so I was doing this though script. This works fine while the period is less than the particle lifetime since the last emit (meaning there are still active particles), but if this period is greater than that, the system does not emit and does not throw an error.
I verified this is the case with a simple scene that just contains a single particle emitter (I used the default) with the startLifetime set to 1.0 and emission turned off, then I added the following script component:
using UnityEngine;
using System.Collections;
public class TestingPSDelay : MonoBehaviour {
private ParticleSystem ps;
private float dt = 0.0f;
private float ed = 0.5f;
// Use this for initialization
void Start () {
ps = GetComponent<ParticleSystem> ();
}
// Update is called once per frame
void Update () {
dt += Time.deltaTime;
if (dt >= ed) {
dt -= ed;
ed += 0.1f;
ps.Emit (1);
Debug.Log ( "Next ed = " + ed );
}
}
}
The console output is as expected with "ed" slowly growing, but after "ed" > 1.0, the system no longer emits particles even though the console output continues.
Pretty sure this is a bug.
Have you tried ps.Clear (); to reset the particle system? Then after it is reset, you should be able to continue the process. Just something to work with maybe...
I have the same problem. ps.Clear() doesn't seem to work, still no emitting. The Emit() did work before the update to 5.3.1p2 though.
Just sent a bug report about it to unity. If anyone has any workarounds this would be awesome :)
Very strange... The only way around this that I can think of is creating a prefab with your particle system and play on awake selected then instantiating it in whenever you need it... Not really optimal but could be "okay" with object pooling. Hope somebody finds something a little more concrete!
Answer by Mischa · Jan 08, 2016 at 04:57 PM
I submitted an issue for this problem to Unity. That's the answer I got from support:
Hey,
Thanks for reporting the issue.
We have fixed this and problem should not appear in the latest version of Unity 5.4, which is currently in beta. You can download it here.
[...]
Answer by hawkwood · Jan 10, 2016 at 07:16 AM
The workaround I found was to change "Simulation Space" from Local to World, and luckily in my situation that is an acceptable solution.
Answer by furibaito · Jan 14, 2016 at 12:06 PM
I've found a temporary workaround for my project, by overriding the startLifetime each time emit() is called.
ParticleSystem.EmitParams emitOverride = new ParticleSystem.EmitParams();
emitOverride.startLifetime = 0.25f;
ps.Emit(emitOverride, 1);
This answer is the holy grail – EmitParams is so incredibly poorly documented. Thank you @furibaito for saving my sanity!
Your answer
![](https://koobas.hobune.stream/wayback/20220612055112im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
[Newbie] Particle System not playing, C# (unity 5.5) 3 Answers
How to Instatiate a particle system on a moving object 2 Answers
Particle system won't restart emitting before last particle has died 3 Answers
How can I make particles apeear in exact position? 0 Answers
How do I change the velocity over lifetime value on a Particle System using a slider? 0 Answers