Performance: Visual effect examples (fire, smoke, sparkle)
MEDIUM IMPACT
This affects the rendering performance and frame rate by how many particles and shaders are used in visual effects.
var ps = gameObject.AddComponent<ParticleSystem>(); var main = ps.main; main.maxParticles = 500; // Use simple additive shader var emission = ps.emission; emission.rateOverTime = 50; // Enable particle culling and LOD
var ps = gameObject.AddComponent<ParticleSystem>(); var main = ps.main; main.maxParticles = 10000; // Using complex shaders and high emission rate var emission = ps.emission; emission.rateOverTime = 1000; // No culling or LOD
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| High particle count with complex shaders | N/A | N/A | High GPU draw calls and shader cost | [X] Bad |
| Optimized particle count with simple shaders | N/A | N/A | Low GPU draw calls and simple shader cost | [OK] Good |