Resetting Particle Systems not working after 5.3.1
Hi guys, previously the code below would reset a particle system, but after 5.3.1 it no longer seems to work?
_ps.GetComponent().time = 0; _ps.GetComponent().Play();
Answer by alternative_richie · Jan 05, 2016 at 12:36 PM
@Jackal16 @DenisM I have got around this by using ParticleSystem.Simulate and ParticleSystem.EmissionModule.enabled.
Here is an example snippet from my code, it plays the particle above a certain speed and stops it emitting below that speed. It's a particle in Local Space and looping but this works on non looping particles also. Hope this helps. DenisM, Might be worth updating bug 756971 with this info if it works for you.
ParticleSystem ps;
ParticleSystem.EmissionModule psemit;
void Start () {
ps = GetComponent<ParticleSystem>();
psemit = ps.emission;
}
void Update () {
if (GameControl.Instance.getMph()>useAboveSpeed)
{
if (!ps.isPlaying)
{
ps.Simulate(0.0f,true,true);
psemit.enabled = true;
ps.Play ();
}
}
else
{
if (ps.isPlaying)
{
psemit.enabled = false;
ps.Stop ();
}
}
}
Answer by mountblanc · Dec 24, 2015 at 11:03 AM
The particals seem to be stuck at their end of life time after playing for first time. When i set the simulation space from local to world and deactivate the attached gameobject and activate it again the particle system works ok. If i turn on loop It also keeps playing. Resetting the time has no effect for me also.
Answer by DenisM · Dec 24, 2015 at 03:47 PM
Got the same issue. Seems like a bug. Opened ticket https://fogbugz.unity3d.com/default.asp?756971_ukumtus3pui9h3qu
Answer by karl_jones · Jan 27, 2016 at 01:20 AM
This is fixed in patch 5.3.2p1 due out later this week
This seems to be somewhat broken again. There are all kinds of weird culling issues happening.
Calling start/ stop does something but depending on where the PS is located (on the screen and off screen )behavior will be different... . Sometimes the PS will actually start and or stop, sometimes they do nothing. $$anonymous$$oving the camera so the PSs are out of view and then co$$anonymous$$g back causes the particles to be turned back on, even if stop has been called. Doesn't matter if stop was called while the ps was on screen or not.
In most cases when moving to the right of the PS (so the particle system is off camera to the left of the screen) the particle system will appear to be turned on permanently.
Still trying to pinpoint the exact cause but it seems to be very inconsistent and not always reproducable.
Setting the particle to world space fixes this as suggested in the past.
(Unity 5.3.4p4)
I have pinpointed the issue. When the particle system is set to local all culling happens compared to the world origin! Not the object origin!
So as long as the world origin remains in screen everything will work fine. If the object in question lies at say 100,0,100 the issues will appear.
Answer by AceOfClubs · Jan 23, 2016 at 07:31 PM
I took @alternative_richie 's example and modified it a bit to work for my system. The problem I had with the original is when the button was pressed I did not want the existing particles playing to disappear. So my bracketing the simulate and enabled in the isplaying statement is only fires when there is no particles on the screen which appears to be when the bug is happening. Took me awhile to find this thread. Thanks a bunch.
Example when a button is pressed
if (isBraking)
{
isBraking = false;
if (!leftExh.isPlaying)
{
leftExh.Simulate(0.0f, true, true);
lEmit.enabled = true;
rightExh.Simulate(0.0f, true, true);
rEmit.enabled = true;
}
leftExh.Play(true);
rightExh.Play(true);
}
When the button is released
if (!isBraking)
{
isBraking = true;
Debug.Log("Stop triggered");
leftExh.Stop();
rightExh.Stop();
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612053314im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Are there any disadvantages to using the legacy Ellipsoid Particle System in Unity 5 over Shuriken. 0 Answers
ParticleSystem.Bake() not working with specific particle 0 Answers
Particles disappear when the parent rotates,My particles disappear when the parent rotates 0 Answers
How to trigger VFX particle 0 Answers