When a button is clicked, how can I work out which button it was? The system is a little counterintuitive in that the whole loop is processed before any buttons can be pressed, therefore the counter variable i is equal to someList.length and not the index of the button that was clicked. I tried using GUI.SetNextControlName (); but when I press a button the GUI.GetNameOfFocusedControl () function returns an empty string. I am not out of ideas as the documentation for events and controls doesn’t mention any queries that can be made as to the control that was clicked.
ok it appears the array index out of bounds exception was not caused by this at all. I apologise for asking the wrong question. The real problem I am having is that if I make a button that makes another button I don’t see the second one.
What appels said… GUI buttons only return true for the frame that they are clicked, so you’ll need to use GUI buttons to set boolean vars, and show/hide the buttons you want other buttons to enable with the booleans.