Skip to content

Instantly share code, notes, and snippets.

@inoook
Created January 26, 2016 05:37
Show Gist options
  • Save inoook/7e86ec3b13c48b2056ef to your computer and use it in GitHub Desktop.
Save inoook/7e86ec3b13c48b2056ef to your computer and use it in GitHub Desktop.
// http://forum.unity3d.com/threads/what-is-the-unity-5-3-equivalent-of-the-old-particlesystem-emissionrate.373106/
public static class ParticleSystemExtension
{
public static void EnableEmission(this ParticleSystem particleSystem, bool enabled)
{
var emission = particleSystem.emission;
emission.enabled = enabled;
}
public static float GetEmissionRate(this ParticleSystem particleSystem)
{
return particleSystem.emission.rate.constantMax;
}
public static void SetEmissionRate(this ParticleSystem particleSystem, float emissionRate)
{
var emission = particleSystem.emission;
var rate = emission.rate;
rate.constantMax = emissionRate;
emission.rate = rate;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment