90. Cubeを並べて壁を作る
int index = 0;
for (int y = 0; y < 5; y++)
{
for (int x = 0; x < 5; x++)
{
GameObject cube =GameObject.Instantiate(cubePrefab);
cube.transform.parent = transform;
cube.transform.localPosition = new Vector3(/*中略*/);
//Cubeに色をつける
cube.GetComponent<Renderer>().material.color
= colors[index];
index++;
index %= colors.Length;
cubes.Add(cube);
}
}
02.txt