What you do is loop through all the controls, set them to white, then set b's text to black.
int i;
GUIButton gb;
while (i < gMainMenu.ControlCount) {
gb = gMainMenu.Controls[i].Asbutton;
if (gb != null) gb.TextColor = 15; // white
i++;
}
if (b != null) b.TextColor = 0;
But there's of course another possibility:
if (b != old_button && b != null) { // mouse has just entered button b
if (b.OwningGUI == gMainMenu) {
aButton_16.Play(); //BUTTON SOUND
b.TextColor = 0;
}
}
if (b != old_button && old_button != null) { // mouse has just left the button old_button
if (old_button.OwningGUI == gMainMenu) {
old_button.TextColor = 15; // white
}
}
The crash you got was probably a null pointer error, right?
You get those whenever you use
aaaaa.bbbbb in your code and
aaaaa happens to be
null.