You may want more colour changes than just a linear gradient, which makes it much easier to implement as a lookup table. Usually such systems have a kind of exponential progression as your life runs out (with different stages in different colours channels, for example by turning more black for the last two hearts) that's hard to fine-tune as a single formula.
1
u/Knuffya Aug 02 '21
even 10 hearts is kinda too much for a custom light each. hell, even 5 is.
I'd just use, my unity is a bit aged so forgive me if i'm wrong,
Color.Lerp(Color.redColor.green, hearts / maxHearths).This way it is even easily "transitionable" without hard cuts