Advertisement

[Unity][File][JSON]文件复制方法用于动态创建json文件

阅读量:

empty.json文件是通过在指定文件夹内创建一个新的.txt文件,并对其名称及扩展格式进行修改后生成的文件。

复制代码
 public void Test_SaveData()

    
     {
    
     if (File.Exists(Application.dataPath + "/Resources/DataSave/Saving001/") == false)
    
     {
    
         Directory.CreateDirectory(Application.dataPath + "/Resources/DataSave/Saving001/");
    
     }
    
  
    
     if (File.Exists(Application.dataPath + "/Resources/empty.json") == true)
    
     {
    
         File.Copy(Application.dataPath + "/Resources/empty.json", Application.dataPath + "/Resources/DataSave/Saving001/empty.json");
    
     }
    
     }
    
    

全部评论 (0)

还没有任何评论哟~