Why doesn’t this code give the RGB value of 217?
var c : float = 217/255;
var color = Color(c,c,c);
Why doesn’t this code give the RGB value of 217?
var c : float = 217/255;
var color = Color(c,c,c);
The problem is that Unity’s Color are floats between 0.0 and 1.0, not values between 0 and 255. There is a Color32 in Unity that has an implicit conversion to Color, so you can make the conversion doing:
var c : float = 217.0/255.0;
var color : Color = Color32(c,c,c);