x


C# \n won't break to a new line

I've been looking around on how to get a long string to break to a new line and I came across n but however everything after n doesn't display can I get some help? Thanks in advance.

    void OnGUI() {
    GUI.Label(new Rect(10, 10, 100, 20), "line one \n line two");
}
more ▼

asked Jul 26 '12 at 09:00 AM

TakMarche gravatar image

TakMarche
12 6 9 14

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Your Rect height is too small to display all lines.

try this instead :

void OnGUI() {
   GUI.Label(new Rect(10, 10, 100, 40), "line one \n line two");
}
more ▼

answered Jul 26 '12 at 09:08 AM

watermy gravatar image

watermy
200 1 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x58
x4

asked: Jul 26 '12 at 09:00 AM

Seen: 546 times

Last Updated: Jul 26 '12 at 09:09 AM