- Home /
Break Line to GUI.Label
Hi, I need to break line in GUI.Label, How can I do it? I can't to use "\n" 'cause I'll take the text of DB for GUI.Label.
Answer by Tommy · May 17, 2011 at 07:40 PM
Maybe you can do something like this:
var theStringFromDB; var theNumberOfCharactersThatsFitsInTheLabelOnOneRow : String; var theNumberOfCharactersThatsFitsInTheLabelOnOneRowOnRowTwo : String; var theLengthOfTheStringFromTheDB = theStringFromDB.Length; var newRow; var newRow2;
if (theLengthOfTheStringFromTheDB >= theNumberOfCharactersThatsFitsInTheLabelOnOneRow) { newRow = theStringFromDB.Insert(theNumberOfCharactersThatsFitsInTheLabelOnOneRow, "/n") theStringToDisplay = newRow;
if (newRow.IndexOf("/n") >= theNumberOfCharactersThatsFitsInTheLabelOnOneRow) { newRow2 = newRow.Insert(theNumberOfCharactersThatsFitsInTheLabelOnOneRowOnRowTwo, "/n") theStringToDisplay = newRow2; } }
Haven't tested and verified at all, but it might get you an idea.
Good Idea but $$anonymous$$y boss doesn't has I use the "\n".
Your answer
![](https://koobas.hobune.stream/wayback/20220613134700im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make a line break in a GUI Label 6 Answers
How would you code a gui to select a label? 0 Answers
How Do I Center A GUI Label? 5 Answers
GUI.Label positioning for many device resolutions 1 Answer
network GUI not working 1 Answer