- Home /
 
 
               Question by 
               KnightRiderGuy · Jan 28, 2015 at 07:39 PM · 
                uiguisliderscrollbar  
              
 
              How do you get Old OnGUI Scripts to work with the New UI Scrollbars?
Sorry for the long title, could not think of a better way to word that question, but yup, that's basically it, how do I get something like this to work with the new UI scroll bars?
This is part of a music player we are tinkering with trying to adapt it to our custom GUI using the new UI system but are having a hard time figuring out how to get it to play nice with the new UI system. I temporarily commuted out the OnGUI stuff to see if I could find the actual function in the drop down in the UI for the slider, but no luck so we're missing some understanding on how this works.
 private var num : int;
 var pm : String[];
 /*function OnGUI () {
     GUI.Label (Rect (70, Screen.height-65, 1000, 30), "("+GetSecondsAsTime(audio.time) + " / " + GetSecondsAsTime(audio.clip.length)+") Play mode ("+pm[num]+")");
     var newTime : float = GUI.HorizontalScrollbar (Rect (50, Screen.height-40, Screen.width-80, 30), audio.time, 1.0, 0.0, audio.clip.length);
     if (GUI.changed) {
         audio.time = newTime;
     } 
 }*/
 
     function GetSecondsAsTime(seconds) {
         var sec = Mathf.Floor(seconds % 60);
         var min = Mathf.Floor(seconds / 60);
         if(sec < 10)
             return min + ":0" + sec;
         return min + ":" + sec;
     }
 
 function Update() {
     num = Camera.main.GetComponent("ST_main").pm;
 }
 
              
               Comment
              
 
               
              Your answer