Hello there,
i’ve asked this before with no reply so i will rephrase my question with a bit of code as well.
So lets say i have a GUI.Box and inside this Box is 20 GUI.Buttons. On left and right side i have a GUI.RepeatButton and when i click on right button it will scroll my track selection to the right, obviously the same goes for the left button just to the left side.
It’s like having my tracks in a loop so i could circle around. I am not very good with words so i hope you understand what i am trying to do.
#pragma strict
var icon : Texture2D;
private var _selectionWindowRect : Rect = new Rect(150,150,560,445);
private var _selectionWindowID : int = 0;
var hSliderValue : float = 0.0;
function OnGUI () {
// GUI.Button(Rect(Screen.width/2 - x,Screen.height/2 - y, x * 2, y * 2),"button");
_selectionWindowRect = GUI.Window(_selectionWindowID, _selectionWindowRect, SelectionWindow, "Select your animal");
}
function SelectionWindow (_selectionWindowID) {
GUI.BeginGroup (Rect (0,0,560,250));
SelectGorilla();
SelectRhino();
SelectFrog();
SelectLion();
SelectOstrich();
SelectDonkey();
SelectZebra();
SelectKangaroo();
SelectVaran();
SelectCamel();
SeparationLine();
GUI.EndGroup ();
// Wrap everything in the designated GUI Area
GUILayout.BeginArea (Rect (20,250,520,200));
//Make a box so you can see where you are on the screen
GUI.Box (Rect(20,30,480,110), "");
for(var i : int = 0; i < 40; i++) {
GUI.Button (new Rect(25 + (80 * i), 45, 80, 80),"Track " + i.ToString());
}
hSliderValue = GUI.HorizontalSlider (Rect (25, 150, 470, 30), hSliderValue, 0.0, 10.0);
GUILayout.BeginVertical();
GUILayout.Box("Choose Track: " + Mathf.Round(hSliderValue));
GUILayout.EndVertical();
//Left Arrow
if (GUI.RepeatButton(Rect(0,30,15,110), "<")) {
if(hSliderValue == 0.0) {
return;
Debug.Log(" Slider is at position 0 ");
} else {
hSliderValue -= 3.0 * Time.deltaTime;
Debug.Log("Clicked the left arrow");
}
}
//Right Arrow
if (GUI.RepeatButton(Rect(505,30,15,110), ">")) {
hSliderValue += 3.0 * Time.deltaTime;
Debug.Log("Clicked the right arrow");
}
GUI.Button (Rect (235, 165, 50, 25)," Play ");
GUILayout.EndArea();
}