What's the difference between two this string type...
string test1 = "First Line
and I loaded the text from .txt file which contain exactly the same "First Line
and assigned to string test2;
In my actual game, test 1 shows the correct result where there are showing two lines like below
test2 just show
any quick tip to fix these bugs?
but in your txt file, you can do this instead:
"Frist Line" +
+ "Second Line"
If that helps ...
" 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:
and declare your variable as
string1 = line1 + "
" + line2.
Or you could replace instances of "
" in the string with a newline char.