Current location - Quotes Website - Personality signature - How to make the text in the label made by GUI.lable larger in Unity? Very urgent
How to make the text in the label made by GUI.lable larger in Unity? Very urgent

void OnGUI()

{

string aa = "We are all fine";

GUIStyle bb=new GUIStyle() ;

bb.normal.background = null; //This is to set the background fill

bb.normal.textColor=new Color(1,0,0); //Set Font color

bb.fontSize = 40; //Of course, this is the font color

GUI.Label(new Rect(0, 0, 200, 200), aa,bb );

}

When making unity3d GUI, you will definitely find that GUI.skin is generally used to control the GUI display effect, but you will also find that fontSize can only be used for dynamic fonts , when used in Label and TextArea, the displayed font will not change and always maintain the default size of the imported font. I have searched online for a long time and have not found an effective method. The only common method is to create multiple fonts with different sizes. Import the font file, and use whatever size you want. Of course, this is very time-consuming, takes up the size of the game, and is inflexible. I later thought, this is not scientific. Although the static display of the font is in the form of a picture, But it can always be set before displaying, otherwise how can it be set dynamically? Later I found out that it can be set with GUIStyle, but everyone ignored the last parameter in GUI.Label(), which is to set GUIStyle.

//This is not written by me. This is the answer I searched for. It should be what you want. It seems that GUI is not used much after 4.6. When programming UI, you are using an old version. ?

We are both newbies, ***Mian!