public void LoadFromFile() { string json = System.IO.File.ReadAllText(persistentDataPath + settingFilePath); Debug.Log("load " + json); settingsDictionary = (DictionaryOfStringAndFloat)JsonUtility.FromJson <DictionaryOfStringAndFloat> (json); SetSliderValues(SceneManager.GetActiveScene().name); }
void Start() { settingsDictionary = new DictionaryOfStringAndFloat(); if (System.IO.File.Exists(persistentDataPath + settingFilePath)) { LoadFromFile(); } else { Debug.Log("could not find " + persistentDataPath + settingFilePath); WriteToFile(); // CopyInto (); } SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; }