- Home /
new Color() not working properly?
Hellooo
Didnt thought that would be a Problem, but I experienced a problem with coloring objects.
I use:
inst.renderer.material.SetColor("_Color",BuildGreen);
To Color an Instantiated Object Green. But it shouldnt be complely green (not like a neonflash green, where you cant see the object anymore)
So I created my own Color
Color BuildGreen = new Color(0,255,0);
I also tried
Color BuildGreen = new Color(0,255,0,255);
Color BuildGreen = new Color(0,255,0,0);
Color BuildGreen = new Color(0,255,0,100);
Its always the neonflash green result, no matter what. However, if I use Color.green.... its working, the object is still visible, even if its too much green. So why isnt it working properly? What I did wrong / have to change?
Thanks in advance.
Answer by numberkruncher · May 19, 2013 at 10:21 PM
Each component of Color
range from 0.0f to 1.0f. You can simply switch to Color32
in your case since that accepts byte components 0 to 255 instead.
Thanks! I can use Color its ok, just didnt know it... Im so used to the byte values of Color components...