- Home /
 
               Question by 
               Chocolade · Oct 19, 2016 at 06:31 PM · 
                c#scripting problemscript.  
              
 
              How do i change the text color on GUI.Label ?
I tried to make style.font.material.color = Color.white; i want the text to be display in white. But i'm getting null exception on this line.
 void OnGUI()
         {
             if (lookatsky == true) 
             {
                 GUIStyle style = new GUIStyle();
                 style.fontSize = 70;
                 style.font.material.color = Color.white;
                 var w1 = 150;
                 var h1 = 150;
                 Rect rect = new Rect((Screen.width-150)/2, (Screen.height-150)/2 + 100, w1, h1);
                 GUI.Label (rect, "The sky is full of spaceships wow this is great", style); 
             }
         }
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Adamcbrz · Oct 19, 2016 at 07:47 PM
Color for that gui system is done using GUI.color
Edit: Sorry didn't realize you were using styles. Found this instead: http://answers.unity3d.com/questions/17683/custom-font-in-guilabel-but-cant-change-its-color.html
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                