For example, I create a new shader with a Color parameter, then create a new material that uses that shader.
I assign that material to a new 3D object, and use an Animator (on another object) to animate that object’s material’s Color values. Hitting Play, I can see the object changing color correctly.
However, I have a component on the object where I just want to query the current animated color from the material.
e.g.
void Update {
Debug.Log(GetComponent().material.GetColor(“_Colour”));
Debug.Log(renderer.material.color);
Debug.Log(GetComponent().sharedMaterial.GetColor(“_Colour”));
Debug.Log(renderer.sharedMaterial.color);
}
All of these only output the value that the Color attribute was BEFORE playing, not while the animation is live. How can I get the live animated value?