onMouseUp on object that didn't receive the onMouseDown

Hello, i need to achieve this. I press the mouse button on one object, than drag the mouse to other object, and then release. So I want to recieve the onMouseUp event on the second object. How is this possible?

(Immagine this like connecting 2 dots :D)

Think you need to rewrite using mouse raycasts.

The normal meaning of OnMouseUp is it went Up on the same thing it went down on. On almost any GUI, if you click down on button A, hold it, move to button B, then let go; then nothing will happen. In other words, OnMouseUp is specially made NOT to work the way you want.

If you switch to a raycast method instead, it’s a little more work, but you can do anything. Input.GetMouseButtonUp(0) fires when they let go, then do a “screen ray cast” to see what you were on. Lots and lots of posts here about finding what’s under the mouse with a raycast.