Update editor component

Hi all im making my first editor expansion component, and i cant seem to make it update when user clicks on an object in the heiarchy.

Basically it opens in a seperate window and copys the transform data but it only updates when i click on the window as im using on gui, iv tried using update but this causes my component to stop working, basically i need it to update when ever a new object is selected

Any ideas

Try to call Repaint().

ok i think i got it thanks to berenger, the trick was to use

void OnSelectionChange(){
Repaint();
}

update caused my component to stop running the update function and i found the other gui methods didnt work thanks