Hi I have a material with transparent/diffuse shader,
In the code, I try to change the color.
When I use :
color.r = 255;
color.g = 0;
color.b = 0;
renderer.material.color = color;
I get the desired colour, but when I use:
color.r = 189;
color.g = 144;
color.b = 45;
renderer.material.color = color;
I always get WHITE, no matter what numbers I plug into R, G and B
any idea why??
There is a big difference between “Color” and “Color32”
You are using color but with the value range of Color32 and that’s it not working out for you
The value range is :
Color : 0 to 1
Color32: 0 to 255
Your
color.r = 255;
color.g = 0;
color.b = 0;
will be cabbed to
color.r = 1;
color.g = 0;
color.b = 0;
(Red)
but your
color.r = 189;
color.g = 144;
color.b = 45;
will be cabbed to
color.r = 1;
color.g = 1;
color.b = 1;
(White)