- Home /
Question by
igotthis · Feb 27, 2014 at 07:54 PM ·
c#guiselectiongrid
SelectionGrid is not returning a value!!
I've written an Inventory system and have come to a point where I want a small submenu to popup in the form of a selection grid, except that the selection grid isn't returning any value, it stays the same value it was initialized to... So stupid.. however, whenever I right click it does return a value, but not on left click...
Here's my code where I use selection grid, I declare my menuChoice int as a global variable.
if(menuActive == 2)
{
menuPos = new Vector2(mouse.x + 13, mouse.y);
menuActive = 1;
}
Debug.Log("Before Selection : " + menuChoice);
menuChoice = GUI.SelectionGrid(new Rect(menuPos.x, menuPos.y, 100, 100), menuChoice, menuItems,1);
Debug.Log(" Selection : " + menuChoice);
Comment
Best Answer
Answer by igotthis · Feb 27, 2014 at 08:09 PM
So i found out what you have to do. You have to wait until the next onGui draw frame until you stop drawing the selectiongrid.
Your answer
![](https://koobas.hobune.stream/wayback/20220613134930im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Staggering buttons with GUI.SelectionGrid 1 Answer