- Home /
 
GUIlayout background image or color
Hi,
I'm working on a mixer, but now I want to work on the look of it, my gui is laid out automatically using a loop for how many tracks there are. However i'm confused as to how to add a color or background image to the individual track.
I can change the background of the mixer using a line like: (but it hides my text so I left it out to show you)
 GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), tex, ScaleMode.StretchToFill);
 
               
Here's how the tracks are laid out:
 void OnGUI()
     {
         GUILayout.Space (10);
  
         GUILayout.BeginHorizontal ();
 
         GUILayout.Space (10);
 
         if (GUILayout.Button ("Add new track")) 
         {
         }
 
         if (GUILayout.Button ("Refresh Mixer")) 
         {
         }
 
         GUILayout.EndHorizontal ();
            //Scrollbar for tracks
         scrollPos = GUILayout.BeginScrollView (scrollPos, GUILayout.Height(320));
           //Diplay tracks horizontally next to eachother
         GUILayout.BeginHorizontal ();
            //Slightly move away from edge
         GUILayout.Space(10);
         for (int i = 0; i < tracks.Length; i++)
         {
         
             GUILayout.BeginVertical(GUILayout.Width(110));
 
             GUILayout.Label("Volume:", EditorStyles.boldLabel);
                     volume = GUILayout.HorizontalSlider(volume, 0, 1);
 
             GUILayout.Label("Pan:", EditorStyles.boldLabel);
             pan = GUILayout.HorizontalSlider(pan, -1, 1);
 
             mute = GUILayout.Toggle(mute, "Mute"); 
 
             playonawake = GUILayout.Toggle(playonawake, "Play On Awake");
 
             GUILayout.Label("Audioclip:", EditorStyles.boldLabel);
             clip = (AudioClip)EditorGUILayout.ObjectField(clip, typeof(AudioClip), true);
 
             GUILayout.Label("Name:", EditorStyles.boldLabel);
             charName = GUILayout.TextArea(charName);
 
             if(GUILayout.Button("Remove Track"))
             {
             }
 
             GUILayout.EndVertical();
 
             GUILayout.Space(10);
 
         }
 
         GUILayout.EndHorizontal ();
         
         GUILayout.EndScrollView ();
         
     }
 
               Thanks for any help!
 
                 
                mixer.png 
                (29.3 kB) 
               
 
              
               Comment
              
 
               
              Your answer