public void initializePiecesToShow(bool randomPieces = true) { if (randomPieces) { for (int i = 0; i < piecesToShow; i++) { showingPieces.Add(GameObject.Instantiate(piecesPrefab.getNextRandomized()).GetComponent <Piece> ()); showingPieces [i].gameObject.SetActive(true); showingPieces [i].createdIndex = i; } } else { for (int i = 0; i < piecesToShow; i++) { showingPieces.Add(GameObject.Instantiate(piecesPrefab.getNext()).GetComponent <Piece> ()); showingPieces [i].gameObject.SetActive(true); showingPieces [i].createdIndex = i; } } piecesShowedCount = piecesToShow; }