I just converted a GUILayout area to be scrollable, and suddenly it doesnt respect the area it is placed in. In the code below, if I comment out the beginScrollview line and the endscrollview line, the list of buttons displays in a bar down the right side of the screen. if I run it as is, they display in a bar down the left side of the screen, and I am unable to change the size or position of the bar by adjusting the XYWH variables (well I can change the buildingMenuH variable and it makes the area shorter as expected, but the others do nothing). This example is almost identical to the one in the docs so I dont know what is going on.
buildingMenuX = Screen.width*0.9;
buildingMenuY = Screen.height*0.1;
buildingMenuW = Screen.width*0.1;
buildingMenuH = Screen.height*0.8;
GUILayout.BeginArea(Rect(buildingMenuX,buildingMenuY,buildingMenuW,buildingMenuH));
buildMenuScrollPosition = GUILayout.BeginScrollView(buildMenuScrollPosition);
GUILayout.BeginVertical();
for(i=0;i<buildings.length;i++)
{
//some buttons
}
GUILayout.EndVertical();
GUI.EndScrollView();
GUILayout.EndArea();
The formatting didn't help me, it still took me ages to spot what you meant. Thank you for the answer though.
– DunkhanI agree with Dunkhan's comment. Also took me forever to see what was wrong. For anyone who comes to this page in the future and is still confused... the calls are mismatched. GUILAYOUT.BeginScrollView vs GUI.EndScrollView (CAPS for emphasis.) GUILayout is not the same as GUI.
– Andy_W