public void OnPointerUp(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Left) { if (!(Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) { SelectableCharacterController.DeselectAll(new BaseEventData(EventSystem.current)); } } }
public void OnEndDrag(PointerEventData eventData) { if (_selectionRect.Area() > 1) { if (!(Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) { SelectableCharacterController.DeselectAll(new BaseEventData(EventSystem.current)); } foreach (var selectable in SelectableCharacterController.AllSelectable) { if (_selectionRect.Contains(Camera.main.WorldToScreenPoint(selectable.transform.position))) { selectable.OnSelect(eventData); } } } SelectionBoxImage.gameObject.SetActive(false); }