private void Update() { bool justClicked = Input.GetMouseButtonDown(0); bool clicked = Input.GetMouseButton(0); var raycastTarget = Raycast(); if (pickup == null) { if (justClicked) { if (raycastTarget == null) { return; } var pickupable = raycastTarget.GetComponent <IPickupable>(); var clickable = raycastTarget.GetComponent <IClickable>(); if (pickupable != null) { pickup = pickupable; pickup.PickUp(); } else { clickable?.Click(); } } } else { if (pickup.GetTransform() == null) { pickup = null; return; } Vector3 force = (GetMousePos() - pickup.GetTransform().position) * holdForce * Time.deltaTime; pickup.GetRigidbody().AddForce(force); pickup.GetRigidbody().velocity = pickup.GetRigidbody().velocity * 0.9f; if (!clicked) { pickup.Release(); pickup = null; } } }