Newline \n not parsing correctly

In the Inspector, \n will always be displayed as \n unless you have “Parse Escape Characters” enabled in the Extra Settings panel. In such case it will be processed as a linefeed.

In a string, C# will convert “\n” into a line feed which will then be handled as such by TMP.

In a string, “\n” tells C# to process the string as a literal and thus is becomes / displays as "" + “n” or two separate characters.

Most of the time when you use some text editor or xml or excel / google spreadsheet, etc. the “\n” gets escaped to “\n” which then results in the "" + “\n” instead of a linefeed.

BTW: If you were to create a simple script that iterates over the string from Google spreadsheet, you would see how the “\n” is escaped into “\n” or literal and not char(10) / linefeed.

P.S. In the TMP Settings file, the default behavior of newly created objects and whether or not Parse Escape Characters will be enabled by default can be set.

2 Likes