I'm trying to make a Level Select screen for my game using GUI.SelectionGrid but I'm having a couple problems:
asked Apr 21 '11 at 12:24 AM
Might be outdated seeing how the question is months old, but hope this helps.
1) I'm guessing you initialized the value of selected to 0 (the first element), thereby setting your first element as the selected element. The way SelectionGrid seems to be implemented, the currently selected element will not react to the "hover" defined in your GUIStyle (someone correct me if I'm wrong). Try selecting another element, then check to see if your first element now properly shows "hover" effects (if it still doesn't, I'm out of ideas).
2) The Input.GetMouseButton function is a global input handler, not specific to your active GUI component, hence the behaviour you are getting.. Because of the way GUI.SelectionGrid is called, we cannot directly define a handler for it.
Might not be the best way to go about it, but this is how I did it previously: