- Home /
File access in Windows 8?
Is it possible to read or write files in Windows 8 without using a plugin?
Answer by Bilelmnasser · Nov 20, 2015 at 03:07 PM
for Windows 8/10 App store , there is only 1 name space UnityEngine.Windows
that you should see those 2 classes :
UnityEngine.Windows.File
UnityEngine.Windows.directory
this is the only way to write or read a file on Windows Universal App
http://docs.unity3d.com/Documentation/ScriptReference/Windows.File.html http://docs.unity3d.com/Documentation/ScriptReference/Windows.Directory.html http://docs.unity3d.com/Documentation/ScriptReference/Windows.Crypto.html
Answer by citizen_rafiq · Aug 30, 2013 at 06:02 PM
public class FileIO : MonoBehaviour {
public static void CreateFile(string path, string fileName){ if(!File.Exists(path+"/"+fileName)){ File.Create(path+"/"+fileName).Dispose(); } }
public static void WriteFile(string path,string fileName,string data){ if(File.Exists(path+"/"+fileName)){ StreamWriter sw = new StreamWriter(path+"/"+fileName); sw.WriteLine(data); sw.Flush(); sw.Close(); }
}
public static string ReadFile(string path,string fileName){ string output=""; if(File.Exists(path+"/"+fileName)){ StreamReader sr = new StreamReader(path+"/"+fileName);
output=sr.ReadLine(); sr.Close(); } return output; } }
yes,this will work in every platform that unity support. different platform has different path location for saving file.
Your answer
![](https://koobas.hobune.stream/wayback/20220613113201im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
android browse and read text files 1 Answer
Create Text file and open - write on it after button click 1 Answer
Generic Save and Load using BinaryFormatter not working 1 Answer
Get Contents of Folder Using UnityWebRequest 0 Answers
Loading multiple files using js, importing a set of xml files 1 Answer