- Home /
Question by
MeTheMinion · Feb 25, 2012 at 03:08 AM ·
buttonselectiongrid
SelectionGrid is unresponsive
Hi all, it's been a while since I've done these, and can't figure out what I might be doing wrong. My selectionGrid displays in the game window, but doesn't seem to return a value
string[] temp = new string[]{"A Button"};
if(showGUI)
{
GUILayout.BeginArea(new Rect(GUIPos.x, Screen.height-GUIPos.y+10, 200, 200));
GUILayout.BeginVertical("box");
Debug.Log (GUILayout.SelectionGrid(towerGridInt, temp, 1));
GUILayout.EndVertical();
GUILayout.EndArea ();
}
The Console does give me the expected readout of "0" when the GUI is opened, but pressing the button does nothing. Any ideas?
Comment
Answer by MeTheMinion · Feb 25, 2012 at 10:27 AM
Answered my own question. The problem I had here was that towerGridInt was being initialized with 0, meaning a selectionGrid button was already returning a value. I changed the initial value of towerGridInt to -1, and now the GUI does what it is supposed to.
Your answer