Hi,
I’m modifying my particles using GetParticles/SetParticles in a script. My particles have Trails module enabled and its “Die with Particles” property is set to false. It works fine on Unity 5.6 and 2017.2 but on 2018.4 and 2019.1, my trails do die with the particles. I’ve narrowed down the issue to the SetParticles
call. If I call it, my trails whose particles have died will be killed instantly (even though “Die with Particles” is disabled). The preview screen shows the number of alive particles as ~60 on 2017.2 but this number is ~30 on 2018.4.
To reproduce the issue:
using UnityEngine;
public class ParticlesIssue : MonoBehaviour
{
private ParticleSystem particles;
private void Awake()
{
particles = GetComponent<ParticleSystem>();
}
private void Update()
{
// Creating an array in Update is inefficient but this is for testing purposes only
ParticleSystem.Particle[] arr = new ParticleSystem.Particle[particles.particleCount];
int aliveParticles = particles.GetParticles( arr );
particles.SetParticles( arr, aliveParticles );
}
}
At runtime, trails behave correctly when the script is disabled but they start disappearing immediately when it is enabled.
I can open an issue but I am looking for a workaround for current Unity versions, if possible.
Any feedback is welcome.