// Update is called once per frame void Update() { if (Input.touchCount > 0) { int indicetoccox = 0; int indicetoccoy = 0; bool assegnato = false; Touch tocco = Input.GetTouch(0); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { CubeScript scriptcubodest = cubearray[i, j].GetComponentInChildren <CubeScript>(); try { bool toccato = scriptcubodest.CubebyTouch(tocco); if (toccato) { indicetoccox = i; indicetoccoy = j; assegnato = true; } } catch { assegnato = false; } } } if (assegnato) { DestroyAreaColor(indicetoccox, indicetoccoy); } } ; }