public void Update() { if (Input.GetMouseButtonDown(0)) { UpdateDragTarget(); if (target != null) { target.PickUp(); dragging = transform; } } else if (Input.GetMouseButtonUp(0) && target != null) { target.PlaceDown(); target = null; dragging = false; } if (dragging) { targetTransform.position = (Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition) + offset; } }