Custom Inspector - Select Other Game Object

I have created a custom inspector for a component. In the inspector there is a button which says “Select Target”. Upon clicking the button, I want my next selection of a GameObject with a Node component to be ignored, instead passing back the clicked object to be stored in a variable.

Worth noting, all nodes are displayed by gizmos.

Anyone done this before?

Thanks to whydoidoit, I was massively over complicating it.
Simply had a variable which contained the currently modifying node, and upon selection of another node, checked if that variable was not null. If it wasn’t null, it set itself as the connected node, and made the previous node selected again.