In Match3 toy move the cubes. If during the movement of the cubes to click on one more - the movement stops. One more time - and the third cube begins to move as the second. While looking for the cause of this bug, the question arose - is it not easier to disable mouse clicks while the cubes are flying from place to place? And how to implement this on the touchscreen?
public void OnMouseDown() { //Если этот кубик не был выбран - он выбирается if (!isSelected && (myController.selectedPieces[0] == null || myController.selectedPieces[1]== null))// Вроде бы должен не выбирать кубик, если массив заполнен, но он всё равно выбирается. { isSelected = true; } else { //Если кубик был выбран ранее и щёлкнули на него же - он перестает быть выбранным isSelected = false; isMoving = false; / } myController.selected(this.gameObject, isSelected); //Вызываем скрипт gameController, передавая ему информацию о кубике. Вызван или не вызван. }
public void OnMouseDown() { if (isMoving) return; ...... остальная логика }public void OnMouseDown() { if (isMoving) return; ...... остальная логика }- Alexey ShimanskymyController? In theory, your handler works only for the object that was clicked on, if other cubes do not behave adequately, then the problem is in the controller that controls the current cube. - KingPeas