Writing this here because this gave me and some friends a headache.
In Unity, animation that change materials do not actually modify the material itself. Instead they animate a MaterialPropertyBlock
.
To get the color after animating, you can use the following snippet:
You probably want to run this in the late update, since that runs after animations.
I found the original solution here: https://discussions.unity.com/t/after-animating-a-custom-material-shader-parameter-how-do-i-get-an-accurate-value-from-script/134688