What I need fixed is that when the buttons exceeds the scroll view width it starts scrolling horizontally, like so:
But what I want it to do is start drawing the buttons down 1 and then horizontal again so the horizontal scroll view is never changed just the vertical and I have a nice block of buttons like in this image I photoshoped:
I have this script:
#pragma strict
var ShopName : String;
var Enabled : boolean;
var BackgroundTexture : Texture;
var Items : String[];
var ItemTextures : Texture[];
private var shopSize : Rect = Rect(Screen.width / 2,0,600,800);
private var scrollPosition : Vector2;
private var currentButton : int;
function Start () {
shopSize = Rect(Screen.width / 2 - 300,0,600,Screen.height);
}
function Update () {
}
function OnInspectorUpdate(){
}
function enable(i : boolean){
if(i == true){
Enabled = true;
}
if(i == false){
Enabled = false;
}
}
function OnGUI(){
if(Enabled == true){
shopSize = GUILayout.Window(200, shopSize, ShopWin, ShopName);
}
}
function ShopWin (windowID : int) {
scrollPosition = GUILayout.BeginScrollView (scrollPosition, false, true, GUILayout.Width(600),GUILayout.Height(Screen.height - 100));
GUILayout.BeginHorizontal();
//if(currentButton == 0)
for(var i:int =0;i<Items.length;i++){
if(ItemTextures.Length > 0){
if(GUILayout.Button(ItemTextures*, GUILayout.Width(60), GUILayout.Height(60)))*
-
{*
-
}*
-
}*
-
else{*
_ if(GUILayout.Button(Items*.ToString(), GUILayout.Width(60), GUILayout.Height(60)))_
_ {*_
* }*
* }*
* //currentButton = currentButton + 1;*
* }*
* GUILayout.EndHorizontal();*
* GUI.DragWindow();*
* GUILayout.EndScrollView();*
}