- Home /
Particle size over time, not lifetime
I want to have a particle emitter where the lifetime varies, but the particle growth rate is constant. If I just set "Size over lifetime" to a straight line, the growth rate of a particle depends on its lifetime - so shorter lived particle grow faster than longer-lived ones. I do not want this. I want a constant growth rate for every particle. Is this possible?
Answer by Jamora · Aug 02, 2013 at 08:20 AM
There is, as far as I know, no knob for this; you will need to access the particles individually. I assume you're using ParticleSystem
Use
Particles[] allParticles = new Particles[gameObject.GetComponent<ParticleSystem>().particleCount];
gameObject.GetComponent<ParticleSystem>().GetParticles(allParticles);
To get all the particles, then lerp Particle.size however you wish. GetParticles will return an int of how many the particle system had at that moment, so you should take that into account.
I would upvote this, but I do not have enough reputation.
Would this method fight the particle system itself as it tries to change particle sizes every frame? Someone has recommended to me to use the legacy particle system ins$$anonymous$$d as you can easily control particles yourself using it without the system trying to do its own thing.