- Home /
 
Additional parameters for GUILayout.Label
I use the following syntax to enlarge the text font of a Label in Unity:
 GUILayout.BeginHorizontal( displayStyle1 );
 displayStyle1.fontSize = 20;
 GUILayout.Label( questiongrid.Title, displayStyle1 );
 GUILayout.EndHorizontal();
 
               But in the following code, it seems that all the possible options have been exhausted, at least to my understanding of the manual pages:
 GUILayout.BeginHorizontal( GUILayout.Height( maxHeights[currentIndex] ) );
 GUILayout.Label( questionScreens[currentIndex][i], rightStyle, GUILayout.Width( Screen.width/3 - 3 ) );
 GUILayout.EndHorizontal();
 
               Could I still manipulate this code and enlarge the text font (of course without having to lose or replace rightStyle)?
Please see attached... I need to increase the font size for the scale boxes that say 1, 2, 3, 4, 5
Thanks

Answer by DoTA_KAMIKADzE · Apr 26, 2015 at 06:56 PM
Seems like I'm missing some part of your point but anyway, why not just increase the font if you need to?:
     rightStyle.fontSize = 50;
     GUILayout.Label(questionScreens[currentIndex][i], rightStyle, GUILayout.Width(Screen.width / 3 - 3));
     //or if you want to keep rightStyle with its original values but change font size only for this lable then:
     GUIStyle newStyle = new GUIStyle(rightStyle);
     newStyle.fontSize = 50;
     GUILayout.Label(questionScreens[currentIndex][i], newStyle, GUILayout.Width(Screen.width / 3 - 3));
 
              Thank you.. It was spot on. I was under the impression that a new variable must be introduced as an additional parameter! Your suggestion works perfectly. Cheers
Your answer