- Home /
Display several paragraphs of text
At the start of each level in my game I need to display 3 paragraphs of text in sequence, and I'm not certain which elements to use. The GUI Text seems to be single-line only, and GUI.TextArea seems to be for accepting input, not displaying it.
Is there a standard method for this? If someone could point me to some tutorials on the subject I'd be really appreciative!
Answer by Kiwasi · Jun 13, 2014 at 09:03 AM
Use "\n" to start a new line. I also believe you can configure it to autowrap
Doesn't seem to work. I've also tried <br> with rich text enabled. Neither work.
$$anonymous$$ake sure you set word wrap to true on your GUI style
Oh sorry, I missed the bit about GUI.Label! Yes that does seem to wrap actually, sorry about that. I was still using the GUI Text
Answer by PommPoirAbricot · Jun 13, 2014 at 11:59 AM
This doesn't work with "\n" if you have in your script a public variable that you initialize in the editor with a text "patati \n patata", it won't work !
This works with "\n" Set up your text directly in your script :
private string text = "patati \n patata";
the "\n" will work in this case
I just noticed that few weeks ago
Thanks, but I don't think forcing a new line with \n is very scaleable. Imagine if the aspect ratio changes and the line length is no longer the same? It's much better to have something with a flexible line length