unity add to txt file
public void WriteToFile(string filename, string data)
{
string FILE_PATH = "D:/" + filename; //full path to file
using (FileStream fs = new FileStream(FILE_PATH,
FileMode.Append))// set FileMode.Append to add data to file
// set FileMode.Create to create new file
// or overwrite existing file
{
using (StreamWriter writer = new StreamWriter(fs))
{
writer.Write(data);
}
fs.Close();
fs.Dispose();
}
}