Hi, I want to create a screen resolution selector in the GUI using a for loop, but the for loop only shows the first execution in the bucle, it not repeats....
The code:
function WindowOptions()
{
GUI.Label (Rect (50,40,100,20), "Resolucin:", "options");
// Resoluciones disponibles
GUI.Box (Rect (50,70,100,200),"");
GUILayout.BeginArea (Rect (50,70,100,200));
var resolutions : Resolution[] = Screen.resolutions;
for (var res in resolutions)
{
if (GUILayout.Button (res.width + "x" + res.height))
{
changedResWidth = res.width;
changedResHeight = res.height;
}
}
GUILayout.EndArea();
GUI.Label (Rect (225,40,150,20), "Nivel de detalle:", "options");
}
I think it is because the loop are in the OnGUI function... so, any way to make the for loop in Update fuction and create the buttons (one for each resoluton) in the OnGUI function??
Sorry for my Span-glish and thanks a lot. ;)