- Home /
How to add a "Enter" (\n) into a file
Greetings, I am having the following issue.
Let me explain it by using my code(assuming the variables are assigned and working):
System.IO.File.AppendAllText(Application.dataPath + "/Highscore.txt", "\n" + WhatLevel.baas+ " Your score: " + finalScore + "\n", );
Now the output becomes:
1 Your score: 27
Wich is good. But, now in level 2. The output of the whole file becomes:
1 Your score: 272 Your score: 47
So the problem is the enter. How do I add an enter so ill get this:
1 Your score: 0
2 Your score: 47
I am programming in C#
Answer by Graham-Dunnett · May 28, 2013 at 03:15 PM
Basically, you need a carriage return in addition to a newline.
Answer by drjd24 · May 28, 2013 at 01:32 PM
I think you should just use seperate Gui for the score, just move the text location of it, but that might just be JavaScript
I know that. But i'd like to store it in a file so I can read it in a highscore menu, even when relaunching the game(else the variables wont save)
Your answer
![](https://koobas.hobune.stream/wayback/20220613103055im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
android browse and read text files 1 Answer
Read and Write to text file Online 4 Answers
Opening a file explorer in run time? 8 Answers