I need to display text in a gui.window , and each time size is different.
I need some solution that acts like textarea but not editable…
I thought of splitting the text and using an another label for another line…
but there must be a better solution.
a GUI.Label also wraps around any text displayed if the style that is used has wordWrap set to true.
Anyway, you can insert “manual” line breaks by inserting a newline character (
) in the string. Example:
GUI.Label(new Rect(10,10,100,100),"This is the first line.
This is the second line.");
GUIStyle textStyle = EditorStyles.label;
textStyle.wordWrap = true;
EditorGUI.LabelField(textRect, text, textStyle);
wordWrap of GUIStyle can work for LabelField as well.