I have a list that contains multiple lists of GameObjects in it. I am trying to get access to one of the GameObjects variables.
Here is what I am trying to do:
private List<GameObject> row1 = new List<GameObject>(3);
private List<GameObject> row2 = new List<GameObject>(3);
private List<GameObject> row3 = new List<GameObject>(3);
private List<List<GameObject>> winning = new List<List<GameObject>>(3);
void Start () {
row1.AddRange(new GameObject[] { board[0], board[1], board[2] });
row2.AddRange(new GameObject[] { board[3], board[4], board[5] });
row3.AddRange(new GameObject[] { board[6], board[7], board[8] });
winning.AddRange(new List<GameObject>[] { row1, row2, row3});
}
bool CheckForWin()
{
foreach (List<GameObject> possiblity in winning)
{
print(possiblity[0].GetComponent<BoardSpaces>.userID);
}
return false;
}