// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hitInfo; target = ReturnClickedObject(out hitInfo); if (target != null) { isDragging = true; target.OnDragged( Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0))); } } if (Input.GetMouseButtonUp(0)) { isDragging = false; //target?.OnDropped( // Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0))); } if (isDragging) { //target?.OnDragStay( // Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0))); } }