void TableroInstance(int posx, int posy) { Tablero matriz = new Tablero(posx, posy, mineSprite, vanilaSprite, freeSprite, paredSprite); jsonToMatriz();//llenamos la matriz con la data del json matriz.matrix = matrix; if (matriz.cellMatrix == null) { matriz.cellMatrix = new Cell[x, y];//crea un objeto matriz con 2 dimensiones matriz.CellMatrixLoop((i, j) => { Cell go = Instantiate(prefab, new Vector3(i + posx, j + posy), Quaternion.identity, transform); //hace una copia de un objeto y ponerlo en otro lugar go.name = string.Format("(X:{0},Y:{1})", i, j); matriz.cellMatrix[i, j] = go; }); } matriz.init(); }