I am trying to make a list of buttons that show up in a window and are scrollable. i have the window and buttons show up fine, but the scrollbar is not showing up and i can not scroll the buttons.
public Vector2 scrollPostion = Vector2.zero;
...
void OnGUI()
{
if (listdownloaded)
{
StopCoroutine("getlevels");
//GUI.Box(new Rect(Screen.width*0.1f,Screen.height*0.1f, Screen.width*0.8f, Screen.height*0.8f), "Custom Levels");
GUI.Window(1, new Rect(Screen.width*0.1f,Screen.height*0.1f, Screen.width*0.8f, Screen.height*0.8f), customlevelbuttonlist, "Custom Levels");
}
else if(loadCustom)
{
...
}
}
void customlevelbuttonlist(int windowID)
{
float count=0;
scrollPostion=GUI.BeginScrollView(new Rect(Screen.width*0.05f, Screen.height*0.05f, Screen.width*0.75f, Screen.height*0.7f), scrollPostion, new Rect(0,0, Screen.width*0.7f, Screen.height*0.65f));
foreach(CustomLevel level in CustomLevels)
{
if(GUI.Button(new Rect(0, buttonheight*count, Screen.width*0.7f, 45), level.Name))
{
Commons.levelLocation=CustomLevels[(int)count].location;
updatepercent();
UpDateAchievements();
Application.LoadLevel(gotoSceneIndex);
Debug.Log(CustomLevels[(int)count].location.ToString());
Debug.Log(SceneIndex);
}
count++;
}
GUI.EndScrollView();
//GUI.DragWindow();
}
i have never worked with scrollviews before so any help i can get would be very appreciated.