I have problem changing material color on gameobjects;
here what is generated:
here is output in console:
(my suggestion is) So values are correct, but they dont apply on material correctly?
here is what color is actually on material:
that one which gets color(yellow, cyan)
are also junk
Any help is appreciated!
void DrawMap()
{
size = new Vector3((bottomLeft.transform.position.x - upperRight.transform.position.x), (bottomLeft.transform.position.y - upperRight.transform.position.y));
for (int i = 0; i < (int)Mathf.Abs(size.x) / gridStep; i++)
{
for (int j = 0; j < (int)Mathf.Abs(size.y) / gridStep; j++)
{
//Color color = new Color(map[i, j], map[i, j], map[i, j], 255);
Color color = new Color(Random.Range(0, 255), Random.Range(0, 255), Random.Range(0, 255));
Vector3 pos = new Vector3(bottomLeft.position.x + i * gridStep + gridStep / 2, bottomLeft.position.y + j * gridStep + gridStep / 2);
GameObject other = (GameObject)Instantiate(cube, pos, Quaternion.identity);
other.GetComponent<Renderer>().material.color = color;
Debug.Log(other.GetComponent<Renderer>().material.color.ToString());
}
}
}