- Home /
Material color won't update!
I have a script that changes the color of the material of this gameObject with:
object.GetComponent<MeshRenderer>().material.color = color;
But, as you can see from the screenshot above, the color update is registered because the R, G and B values do change, but the black bar next to "Albedo" stays the same (and so does the gameOcject itself).
I've used this same code to change colors of other objects and it works great, is this a bug?
Also, if I manually change the color it does update properly.
Answer by CorvoYT · May 15 at 08:16 AM
I found the issue.
Basically, my code was sometimes setting the RGB values of the color to things greater than 1 or lower than 0. Fixing that with a little bit of extra math in the code solved the problem.
Answer by sharatachary · May 15 at 03:24 AM
Can you please create a new material and try the same, instead of using the Default-Material. It should work.