Dragging between two gameobjects

In my game the player needs to drag a path between two game objects. My plan was to have the game objects have a OnMouseDown funtion that sets the start point of the path and a OnMouseUp command to set the end point. The proplem is the OnMouseUp command is run for the same object that was first clicked on. Not the object the mouse is currently over.

Can anybody think of a way to do this?

You need to have a central user input controller and do raycasts to determine what is clicked on and what is clicked “off” :wink: