- Home /
Question by
$$anonymous$$ · Jan 29, 2013 at 10:13 AM ·
inspectorcolor
Color is white in inspector
I have a few inspector fields in my C# code:
public Color BackgroundColor = new Color(45, 50, 125, 255);
public Color TextColor = new Color(228, 228, 228, 255);
public Color WarningColor = new Color(254, 213, 0, 255);
public Color ErrorColor = new Color(241, 74, 36, 255);
But when I add my script to a component all the colors are white except for the yellow. I tried to reset the colors in the Reset method but that doesn't work either, they stay white until I change them in unity.
Can this be fixed, does someone know why this happens?
Comment
Best Answer
Answer by paulaceccon · Jan 29, 2013 at 07:49 PM
Check this: http://docs.unity3d.com/Documentation/ScriptReference/Color.Color.html
The problem probably occurs cause you are using the range from 0 to 255, but Unity works with 0 to 1.
Aargh, you are right. Didn't think about that. Thanks
Your answer
![](https://koobas.hobune.stream/wayback/20220613091758im_/https://answers.unity.com/themes/thub/images/avi.jpg)