- Home /
How to make a line break?
I cannot believe how simple this may sound, but how impossible it seems to be.
I have a simple text object on my GUI. Now and then I want it to display a message, such as "You were hit by a big bad goblin". But I would like it to create a new line after whatever might already be there. So i've created this very simple line of code:
status.text = status.text + "You were hit by a big bad goblin";
Unfortunately, it just wraps around the limits of the text box, and I wont get a new line with each new message. I've tried the /n and //n and /r/n escapes, I've even tried the Environment.newLine thing, which seems to be deprecated.
Surely Unity has a means of creating a newline from a simple string, I just have no idea what it is.
Can anyone help me out? (C# please, if applicable)
Reading not your friend? Doesn't work. It just adds "/n" to the actual text.
Answer by losingisfun · Jun 02, 2016 at 05:39 AM
Found an answer to this (I'm surprised this hasn't been well documented). Here is the post