x


EditorGUILayout.TextArea Wrap

I have a custom inspector with a TextArea field, but it does not wrap, which is a real pain to work with. I've tried changing the skin settings, but no luck. I'm trying to do the following during OnInspectorGUI, but to no avail:

var skin : GUISkin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector);
skin.textArea.wordWrap = true;

I've also tried:

function OnGUI() {
    if(GUI.skin.customStyles.Length > 0)
        GUI.skin.customStyles[0].wordWrap = true;
}

But no luck either.

Any suggestions?

more ▼

asked Dec 08 '10 at 05:57 PM

Steven Walker gravatar image

Steven Walker
862 25 32 48

If you're using EditorGUI.TextArea then the dos indidate that you'll want to modify EditorStyle.textField, not GUI.skin.textArea.

http://unity3d.com/support/documentation/ScriptReference/EditorGUI.TextArea.html

Dec 08 '10 at 11:55 PM yoyo
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

As yoyo suggested, setting the attribute on EditorGUI.textArea fixes the problem. I add the following line of code and it works:

EditorStyles.textField.wordWrap = true;
more ▼

answered Mar 31 '11 at 12:00 AM

Steven Walker gravatar image

Steven Walker
862 25 32 48

(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:

x463
x55
x21
x16
x3

asked: Dec 08 '10 at 05:57 PM

Seen: 1928 times

Last Updated: Dec 08 '10 at 05:57 PM