The short version: Is it possible to put a carriage return in a string variable whose content is specified in the inspector?
The long version: In my current project I have an array of different strings that are pulled into a guiText element. These strings are brief descriptions of items the player can equip (iron sword +2, blah blah blah) that are usually just a line or two long. The tricky thing is, I’d like to be able to just type these descriptions into the inspector, but some of them need to have carriage returns in them since they are more than one line long, and GUIText/TextMeshes don’t have any built in line wrapping.
If I set the text of a GUIText object or TextMesh via scripting, I can insert carriage returns via the special character \n. But if I type \n into the inspector, Unity doesn’t evaluate it as a carriage return, and just prints it out! Arg!
I know this is going to sound like overkill… In a text editor, type out everything that you want… returns and all, copy and paste it into the inspector. (this works on mac and pc. )
Add the TextAreaAttribute to your string variable, and the Inspector will now provide you with a larger text entry box that allows you to just use the Enter key to make carriage returns. Yay!