UnityEngine.Windows 命名空间
提供文件操作的静态方法
这是System.IO.File类的替代方法。注意:此类仅在通用Windows平台时可用。
只有4个静态方法
File.Delete
删除特定文件
public static void Delete(string path);
File.Exists
确定指定的文件是否存在。
public static bool Exists(string path);
File.ReadAllBytes
打开二进制文件,将文件内容读入字节数组,然后关闭该文件。
public static byte[] ReadAllBytes(string path);
File.WriteAllBytes
创建一个新文件,将指定的字节数组写入文件,然后关闭文件。如果目标文件已经存在,它将被覆盖。
//path 要写入的文件
//bytes 要写入文件的byte数组
public static void WriteAllBytes(string path, byte[] bytes);