- Home /
Question by
Bluestrike · Nov 26, 2012 at 01:31 PM ·
guiselectiongrid
Selection grid not working?
In the following code, it always prints 0 while I set it to 1, even when I press one of the buttons it does not change. Whats wrong with my code?
var SelectedMPLevel :int = 1;
var MpLevelImages :Texture2D[];
var colums :int = 3;
function OnGui()
{
GUI.SelectionGrid(Rect(156, 250, 700, 400), SelectedMPLevel, MpLevelImages, colums);
print(SelectedMPLevel);
}
Comment
Best Answer
Answer by KiraSensei · Nov 26, 2012 at 01:35 PM
Try :
SelectedMPLevel = GUI.SelectionGrid(Rect(156, 250, 700, 400), SelectedMPLevel, MpLevelImages, colums);
It reevaluates every frame the var SelectedMPLevel to your selection.
Doh I should have seen that in the example documentation. Thanks.