What if your particles could magically change color and size all by themselves, making your game look amazing?
Why Color and size over lifetime in Unity? - Purpose & Use Cases
Imagine you want to create a firework effect in a game where sparks change color and size as they fade away. Doing this by hand means adjusting each spark's color and size frame by frame.
Manually changing color and size for every particle over time is slow and tiring. It's easy to make mistakes, and the effect won't look smooth or natural.
Using "Color and size over lifetime" lets you set rules that automatically change these properties as particles live and die. This makes effects look smooth and saves lots of time.
for each particle: if age < 1s: color = red size = 1 else: color = black size = 0.1
particleSystem.colorOverLifetime.enabled = true;
particleSystem.colorOverLifetime.color = gradientRedToBlack;
particleSystem.sizeOverLifetime.enabled = true;
particleSystem.sizeOverLifetime.size = curveFrom1To0.1;You can create beautiful, dynamic effects that change naturally over time without writing complex code.
Think of a magic spell in a game where glowing orbs start bright and big, then slowly shrink and fade to nothing as they disappear.
Manually changing particle color and size is slow and error-prone.
Color and size over lifetime automate smooth transitions.
This makes creating realistic effects easy and fast.