any idea how to make markers on a horizontal slider?
I imagine it as some triangles under some certain parts of the slider, if you click them, the hSlider will be taken to the place they are marking.
They will also be needed to be created during runtime.
so, example:
var hSlider = 0;
hSlider = GUI.HorizontalSlider (Rect (20,20, 300, 30), hSlider, 0, 100);
-[you slide the slider by the slider handle]
-[you're at position 37, let's say, or 0, or 63, or 89, whatever]
if(Input.GetKeyDown(KeyCode.Space)){ //place the marker
-[marker is placed in the spot, directly under the slider handle, let's say 67 is right now the value of hSlider]
-[you decide to keep sliding, but if you press the marker under 67, the sliderHandle (and the hSlider value, ofcourse) will be taken to 67],
-you can create mayn such markers on the hSlider during runtime
any idea hwo to solve the problem? =====================================================================
=====================================================================
EDIT:
about placing buttons under the slider:
var pos1 = 0;
var hSlider = 0;
function OnGUI(){
hSlider = GUI.HorizontalSlider (Rect (0,0, 300, 30), hSlider, GUI_min, GUI_max);
GUI.Button(Rect(pos1,10,10,10), "H");
}
function Update(){
if(Input.GetKeyDown(KeyCode.Space)){
pos1 = hSlider-5; //half of the button's width
}
I get the button slightly missplaced.
if it's in the centre, it's allright:
as it goes to the sides - it gets missplaced more and more.