- Home /
modify particle system startLifetime over time
Im trying to reduce the size of a flame I've made with a particle system, I need it to get smaller over time without affecting its style or the parent scale, the best option I thought is to change the startLifetime of the particle system which does work brilliantly, but trying to do this at run-time isn't working. I can get the particle system main module and assign a float to it and the value is updated and works fine but if I try to compare against it or update it over time i get an error that Operator > (or-=)' cannot be applied to operands of type
UnityEngine.ParticleSystem.MinMaxCurve' and `float', so how come i can set a float to it but can't compare it against a float? what am i missing? heres the code
if(main.startLifetime > psSizeMin){
main.startLifetime -= reduceHealth * Time.deltaTime; //reduce size
}
Answer by martipello · Oct 29, 2017 at 08:41 PM
sorry fixed it
float size = main.startLifetime.constant;
if(size > psSizeMin){
size -= reduceHealth * Time.deltaTime; //reduce size
main.startLifetime = size;
}
Not tried it yet, but thanks! i have the same issues too :D
Your answer
Follow this Question
Related Questions
Animation Curve to Float variable? help! 1 Answer
Edit curve's time scale 0 Answers
Dynamic Particle System Lifetime?? 2 Answers
How to destroy / hide a single particle? 2 Answers