public void ReadSaveData() { try { if (File.Exists(Application.persistentDataPath + "/" + savePath)) { //Debug.Log("Reading From: " + Application.persistentDataPath + "/" + savePath); StreamReader reader = new StreamReader(Application.persistentDataPath + "/" + savePath); int currentIndex = 0; while (!reader.EndOfStream) { string inp_ln = reader.ReadLine(); //Read In Save Data if (inp_ln == "True") { //Debug.Log("Level "+currentIndex+" is Unlocked"); levelsUnlockStatus[currentIndex] = true; } else if (inp_ln == "False") { levelsUnlockStatus[currentIndex] = false; } else if (inp_ln != "") { crawlHighScore = int.Parse(inp_ln); } //Debug.Log("Data (" + currentIndex + "): " + inp_ln); currentIndex++; } reader.Close(); LevelSelectManager levelSelectManager = GameObject.FindObjectOfType <LevelSelectManager>(); if (levelSelectManager) { levelSelectManager.UpdateLevels(levelsUnlockStatus); } } else { System.IO.File.WriteAllText(Application.persistentDataPath + "/" + savePath, ""); //createfile WriteDefaultSaveValues(); ReadSaveData(); } } catch (Exception e) { Debug.Log(e); } }