The txt file refuse to save in persistentDataPath and it get saved in project folder or in game folder if build
if (!Directory.Exists(Application.persistentDataPath + "/Maps"))
Directory.CreateDirectory(Application.persistentDataPath + "/Maps");
if (!File.Exists(path + "Level01.txt"))
{
TextAsset l01 = Resources.Load("Level01") as TextAsset;
string data = l01.text.Replace(Environment.NewLine, string.Empty);
string[] dataArray = data.Split('-');
//File.WriteAllText(path + "Level01.txt", data);
StreamWriter sr = new StreamWriter(path + "Level01.txt", true);
for (int i = 0; i < dataArray.Length; i++)
{
if(i == dataArray.Length -1)
sr.WriteLine(dataArray*);*
else
sr.WriteLine(dataArray + “-”);
}
sr.Close();
}
If I change to dataPath it refuse to create folder.
Anyone have any idea what is happening ? I use the latest version of unity 2019