public void VisualizeBlocks(BlockStruct[,] GameBoard) { for (int x = 0; x < GameBoard.GetLength(0); x++) { for (int y = 0; y < GameBoard.GetLength(1); y++) { GameObject newBlock = Instantiate(this.block, new Vector3(x, 0, y), Quaternion.identity); newBlock.transform.parent = transform; newBlock.name = $"Block[{x},{y}]"; BlockScript blockScript = newBlock.GetComponent <BlockScript>(); blockScript.SetStartData(GameBoard[x, y].Color, x, y); GameBoard[x, y].SetDelegates( blockScript.Deactivate, blockScript.Activate, blockScript.Deselect, blockScript.Select, blockScript.SetColor ); } } }