👋 Hey everyone, I’ve got a pro-level question 😄
I'm working with a material that has the following settings:
Emission color: `RGB(191, 191, 191)` → so about 0.75 in 0–1 space Intensity: 2
It looks perfectly fine in-game with these settings. (nice, emission and bloom)
Now here’s the problem:
We’re animating the emission color by writing to a MaterialPropertyBlock, lerping the color towards black (0) when the Lantern is turned off.
But for some reason, Unity seems to be changing the color to something like RGB(3, 3, 3) 🤔 This causes a very bright material at the start of the animation.
That makes no sense to me, I’d expect something like RGB(1.5, 1.5, 1.5) based on the initial values and intensity. (colors * intensity)
The result is that the material becomes way too bright, and I can’t figure out why.
✅ This version works fine (correct brightness/emission):
public void SetEmissionColor(Color color) { if (targetRenderer != null && targetRenderer.materials.Length > MaterialID) { Debug.Log($"SetEmissionColor {color}"); targetRenderer.materials[MaterialID].SetColor(EmissionColorID, color); } }
❌ But this version gives the unexpected bright result:
public void SetEmissionColor(Color color) { targetRenderer.GetPropertyBlock(_block, MaterialID); Debug.Log($"SetEmissionColor {color}"); _block.SetColor(EmissionColorID, color); targetRenderer.SetPropertyBlock(_block, MaterialID); }
My question:
Is Unity somehow not applying the emission intensity properly when using MaterialPropertyBlock?
Or am I missing something obvious?
Any help or ideas would be appreciated! 🙏
