void WriteFiles() { // StreamWriter sw = new StreamWriter("D://result.txt"); FileInfo myFile = new FileInfo(@"D://result.txt"); StreamWriter sw = myFile.CreateText(); for (int i = 0; i < nameList.Count; i++) { sw.WriteLine(nameList[i]); Debug.Log("写入"+nameList[i]); } sw.Close(); } List<string> ReadFiles() { List<string> list = new List<string>(); StreamReader sr = File.OpenText(@"D://result.txt"); string nextLine; while ((nextLine = sr.ReadLine()) != null) { // Console.WriteLine(nextLine); Debug.Log("读取"+nextLine); list.Add(nextLine); } sr.Close(); return list; }