Different between string from Editor Type and txt file.

Hi there, What's the difference between two this string type...

string test1 = "First Line Second Line";

and I loaded the text from .txt file which contain exactly the same "First Line Second Line"

and assigned to string test2;

In my actual game, test 1 shows the correct result where there are showing two lines like below

First Line
Second Line

and test2 just show

First Line
Second Line

any quick tip to fix these bugs?

Not sure,

but in your txt file, you can do this instead:

"Frist Line" + + "Second Line"

If that helps ...

Putting " " in a text file doesn't make a newline character, it just adds the characters "\" and "n". Hitting return in a textfile is what makes a newline character. That's not a bug or incorrect; in fact it's probably more correct. The string parser in the Unity compiler interprets " " in strings declared within code as a newline character.

You can just read two lines:

First Line
Second Line

and declare your variable as

string1 = line1 + "
" + line2.

Or you could replace instances of " " in the string with a newline char.