Created
January 26, 2016 05:37
-
-
Save inoook/7e86ec3b13c48b2056ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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