예제 #1
0
파일: BaseDataMgr.cs 프로젝트: hjj0416/Demo
    protected void Read(Type t)
    {
        string filePath = Path.Combine(Application.persistentDataPath, file_path);

        Debug.Log(filePath);
        if (!File.Exists(filePath))
        {
            FileOperate.FileCreate(filePath);
        }
        string content = FileOperate.ReadFile(filePath);

        if (string.IsNullOrEmpty(content))
        {
            data = t.Assembly.CreateInstance(t.ToString()) as BaseData;
        }
        else
        {
            data = JsonUtility.FromJson(content, t) as BaseData;
        }
    }