void CheckMouseInput() { //begin drag if (Input.GetMouseButtonDown(0)) { Vector2 clickWorldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); CheckClickPosition(clickWorldPosition); } //Drag if (clickable != null) { clickable.OnDrag(Input.mousePosition); } //End drag if (Input.GetMouseButtonUp(0) && clickable != null) { clickable.OnEndDrag(); clickable = null; } }