Question by
anthrodi · Feb 17, 2017 at 10:07 PM ·
unity 5particlesparticle systemparticle emitter
Fade particle emission rate over time
Hi all, new to scripting and to Unity in general. I have a rain particle system that I want to slowly fade out. I was able to disable the emission by setting the rate to 0. What I want to do is have the emission change from it's current value (200) to 0 over a few seconds. Would I use a lerp or something? Here's what I have so far.
private ParticleSystem rainPart;
bool beautifulDay;
void Start () {
rainPart = GetComponent<ParticleSystem>();
}
void Update () {
if (beautifulDay)
{
var emission = rainPart.emission;
emission.rate = 0.0f;
}
if (Input.GetKeyDown (KeyCode.P))
{
beautifulDay = true;
}
}
Comment
Your answer
Follow this Question
Related Questions
Particle collision Lifetime "Gain"? 1 Answer
Are there any disadvantages to using the legacy Ellipsoid Particle System in Unity 5 over Shuriken. 0 Answers
How to make Particle System on when I throw grenades on ground after 5 second. 3 Answers
Timing with a Particle effect 1 Answer
Need help with gpu particles attached to skinned mesh! 1 Answer