Question by
jed_freeman99 · Nov 11, 2016 at 11:30 PM ·
arraysfor-loop
My Board printing isn't working for my Game of Life automaton, please help!
This is the subroutine that handles my grid layout. For some reason it only outputs one column of cells which are correctly generated so I know that something works here. Something seems to be going wrong when the subroutine tries to do multiple columns (i.e. to make the grid). I'm fairly new to unity so I have no idea what is going wrong. Any help will be greatly appreciated.
void BoardSetup()
{
CellArray = new GameObject[columns, rows];
for (int x=1; x < columns + 1; x++)
{
for (int y = 1; y < rows + 1; y++)
{
CellArray[x,y] = Instantiate(Cell, new Vector3(x, y, 0f), Quaternion.identity) as GameObject;
if (rand.Next(0, 10) < chance)
CellArray[x,y].SetActive(true);
}
}
}
Comment