- Home /
Changing the size of a GUI label
Is there a way to change the size of a GUI label. here is the code i used for the GUI label:
GUI.Label(Rect(10,10,200,30), "You survived " +totaltime + " Seconds");
How do i cahnge the font size of the words, "You Survived", the variable "totaltime", and the word "Seconds"
And help would be nice
you need to define a GUISkin/GUIStyle to replace the font. And you can change the font size by double clicking it and then you'll see Font size in your inspector.
Answer by Scribe · Apr 21, 2011 at 06:26 PM
for my own HUD I used this method as i had imported quite a few of my own fonts and was using lots of different fonts.
I imported my desired font and changed the size of that specific font in the inspector (for me I changed it from 16 to 40)
I then added a variable
MyFont
or whatever you want and choose the font you want
you then add the line
GUI.skin.font = MyFont;
before each label that you want to have a different font
var MyFont : Font;
function OnGUI () { GUI.skin.font = MyFont; GUI.Label(Rect(10,10,200,30), "You survived " +totaltime + " Seconds"); }
Your answer
Follow this Question
Related Questions
Changing a GUILabel text SIZE 3 Answers
How to set the font size in GUI.Label 2 Answers
Color.white not so much white... 3 Answers