My SetPixel() doesnt doesnt set... HELP PLEASE!
I'm trying to create a texture generator from a biome variable () no problem with that. But when I use SetPixel(), nothing seems to work... my texture stay gray with all pixels at rgb(1.000, 1.000, 1.000)... I have do many tests and I'm sure the problem come from there.
This is the code:
Texture2D GetRenderTexture() { Texture2D texture = new Texture2D(width, height);
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
Color color = new Color();
Biome biome = GetBiome(x, y);
switch(biome)
{
case Biome.Forest:
color = new Color(72, 188, 49);
break;
case Biome.Grassland:
color = new Color(65, 226, 34);
break;
case Biome.Jungle:
color = new Color(34, 214, 94);
break;
case Biome.Desert:
color = new Color(214, 205, 34);
break;
case Biome.Iceland:
color = Color.white;
break;
case Biome.ColdForest:
color = new Color(58, 142, 35);
break;
}
texture.SetPixel(x, y, color);
}
}
texture.Apply();
return texture;
}
Please help me!
Comment