Auto Gen File

 avatar
unknown
csharp
2 years ago
753 B
4
Indexable
using UnityEngine;
using System.IO;
using static System.Environment;
using System;
public class JsonFile : MonoBehaviour 
{
    public void Start()
    {
        CreateFile2();
    }

    public void CreateFile2()
    {
        string folderName = "#$#$#$";
        string fileName = "#$#$#$.json";
        string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), folderName);
        string filePath = Path.Combine(folderPath, fileName);

        if (!Directory.Exists(folderPath))
        {
            Directory.CreateDirectory(folderPath);
        }
        //                    FileName     Info
        string jsonData = "{\"########\":\"#####\" }";
        File.WriteAllText(filePath, jsonData);
    }
}
Editor is loading...