Select units like in RTS Game

Hello everybody,
I searched many post on forum and didn’t find answear.

I would like make selecting system like RTS games. For examples in Starcraft game is many unit and each of them can be select individually. I have a problem with switching between units. When I click on the first unit, (all is ok), unit is select and on the screen is menu this unit. Problem is that I do not know, how to do that, when I click on another unit, the previous unit is deselect it menu is hide and new unit is select with menu.
Do You have any idea,how to do this selectons between many units?
Thanks for help