# Interaction between GUI and character(s)

This is more a question about architecture. Not sure if there's a right or wrong:

Let's assume I have some gameobjects:

• GUI: A menu containing some elements like "Go to position". It's opened when right clicking in the game
• Main Camera
• Characters: Characters in the game which can be controlled by the player

Now I was thinking about the following scenarios:

1. A character is clicked. It's highlighted yellow. This should definitely be done in the script of the character.
2. When a character is highlighted (or selected) and the right mouse button is clicked, the GUI will be shown. Where does this have to be implemented when talking about clean code? In the character? But then the character has to know about the GUI. I'm not sure if this is clean. In the GUI? Then then the GUI has to know if a character was highlighted (or selected). Doesn't feel clean too.
• For 1, you could have a SelectionManager, this will managed all currently selected characters. For 2, you could use a CharactersCoordinator, in which the GUI will notify that user has requested a "Go to position". The CharactersCoordinator would then use the SelectionManager to move the currently selected characters. – Luis Estrada Oct 19 '15 at 13:35
• For 1 ... how can the SelectionManager be informed by the character that it was selected/highlighted? – mosquito87 Oct 19 '15 at 14:03