- Home /
multi line label with different font?
Hi, I'm making a scene that tells a story using text. I'm using GUI.Label to do it. It worked perfectly fine until I changed the font to one I got from dafont.com. Now it just writes completely off the screen when it gets there, instead of going to the next line. Here's the script. (By the way, I adapted the typewriter script for this, because my game is like an rpg).
var letterPause = 0.01; var Story : int = 1; var words : String = ""; var fontStyle : GUIStyle; private var word;
function Start () { if(Story == 1) { word = " Once upon a time, there was a man. This man was strong, cunning, and brave. His name was Elden Bremseth. Elden longed for adventure. When he turned 18, he went for it."; } TypeText (); }
function TypeText () { for (var letter in word.ToCharArray()) { words += letter; yield WaitForSeconds (letterPause); }
} function OnGUI() { GUI.Label(Rect(5,0,Screen.width - 50,Screen.height),words,fontStyle); if(GUI.Button(Rect(Screen.width/2,Screen.height - 100,150,100),"Continue to Game")) { MainMenuScript.loadGame(); }
}
Answer by spinaljack · May 28, 2010 at 08:34 PM
Set the word wrap to true on the custom GUI Style
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
Changing the size of a GUI label 1 Answer
Change Font Size of GUI Table 0 Answers
Why does my non-dynamic label text not resize in Android? 2 Answers