public void CreateSaveFile(string WorldName, string WorldSeed) { //Create instance of Save Data m_LoadedSave = new GameSave(); m_LoadedSave.Init(WorldName, WorldSeed); string tempPath = SaveDirectory + "/" + WorldName + m_FilePostfix; //Debug.Log(SaveDirectory + "/" + WorldName + m_FilePostfix); //Debug.Log(WorldName); //Debug.Log(m_FilePostfix); //Avoid Duplicate file int i = 1; while (File.Exists(tempPath)) { tempPath = SaveDirectory + "/" + WorldName + '(' + i + ')' + m_FilePostfix; ++i; } m_LoadedFilePath = tempPath; Debug.Log(tempPath); string strJson = JsonUtility.ToJson(m_LoadedSave); File.WriteAllText(tempPath, strJson); IsSaveFileLoaded = true; }