Search Unity

Invisible thumb on horizontal slider

Discussion in 'Immediate Mode GUI (IMGUI)' started by Gaba, Apr 8, 2010.

  1. Gaba

    Gaba

    Joined:
    May 29, 2009
    Posts:
    41
    Hey guys, how´s it been?

    I´m doing some horizontal sliders, and i can´t make it work with a custom skin, i found [url = http://forum.unity3d.com/viewtopic.php?t=7562&highlight=horizontal+slider+thumb]this topic[/url], but the question wasn´t answered

    also, my code

    Code (csharp):
    1.  
    2. GUI.BeginGroup(Rect(560,450,videoBackground.width,videoBackground.height), videoBackground);
    3.    
    4.     var _rect:Rect = new Rect();
    5.     var myStyle:String = "horizontalslider";
    6.    
    7.     // LINE 1 - Resolution
    8.    
    9.     _rect = Rect(146,54, getSizeFromStyle(myStyle, "width"),getSizeFromStyle(myStyle,"height"));
    10.    
    11.    
    12.     OptionsVideoCurrentIndexResolution = Mathf.Round(GUI.HorizontalSlider(_rect,OptionsVideoCurrentIndexResolution,0,(_allResolutions.length-1),skin.GetStyle("horizontalslider"), skin.GetStyle("horizontalsliderthumb")));
    13.  
    So, it basically cycles trough avaiable resolutions via a slider

    So, if any of you guys can help me, i would be very thankful
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    The GUI.HorizontalSlider function accepts two separate GUIStyle objects, one for the main slider and the other for the thumb. You can use this to set the thumb's background image to something completely transparent.
     
  3. Gaba

    Gaba

    Joined:
    May 29, 2009
    Posts:
    41
    I´m sorry, but i want the exact opposite of this

    as you can see, i am setting two different styles, and right now my thumb is invisible, and i want it to be visible
     
  4. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Ahem, sorry...

    Are you sure the _allResolutions array is initialised? Try printing out the value of _allResolutions.length - 1 just before the HorizontalSlider call to make sure this expression is OK.