Performance: Color and size over lifetime
MEDIUM IMPACT
This affects the rendering performance by controlling how particle colors and sizes change over their lifetime, impacting GPU workload and frame rate.
var ps = GetComponent<ParticleSystem>();
var col = ps.colorOverLifetime;
col.enabled = true;
col.color = new ParticleSystem.MinMaxGradient(Color.white);
var size = ps.sizeOverLifetime;
size.enabled = true;
size.size = new ParticleSystem.MinMaxCurve(1f);var ps = GetComponent<ParticleSystem>();
var col = ps.colorOverLifetime;
col.enabled = true;
col.color = new ParticleSystem.MinMaxGradient(
new Gradient() {
colorKeys = new GradientColorKey[] {
new GradientColorKey(Color.red, 0f),
new GradientColorKey(Color.green, 0.5f),
new GradientColorKey(Color.blue, 1f)
},
alphaKeys = new GradientAlphaKey[] {
new GradientAlphaKey(1f, 0f),
new GradientAlphaKey(0f, 1f)
}
}
);
var size = ps.sizeOverLifetime;
size.enabled = true;
size.size = new ParticleSystem.MinMaxCurve(1f, AnimationCurve.EaseInOut(0f, 0f, 1f, 1f));| Pattern | GPU Calculations | Shader Complexity | Frame Rate Impact | Verdict |
|---|---|---|---|---|
| Complex gradients and curves | High per particle | High | Can cause frame drops on low-end GPUs | [X] Bad |
| Simple constant colors and sizes | Low per particle | Low | Smooth frame rates even on weaker devices | [OK] Good |