Пример #1
0
 void Start()
 {
     // Debug.Log("ComfortManager Start");
     instance     = this;
     settingsData = new ComfortSettingsData();
     Load();
     // SetDefaults();
 }
Пример #2
0
    public void Load()
    {
        string fullPath = Path.Combine(Application.persistentDataPath, settingsFile);

        try
        {
            string data = File.ReadAllText(fullPath);
            Debug.Log("Comfort Data: " + data);

            // JsonUtility.FromJsonOverwrite(data, settingsData);
            settingsData = (ComfortSettingsData)JsonUtility.FromJson(data, typeof(ComfortSettingsData));
            Debug.Log("Comfort Load.settingsData: " + settingsData);

            // UpdateUI();
            EventManager.instance.UpdateComfortSettingsUI();
        }
        catch (Exception e)
        {
            #if UNITY_EDITOR
            Debug.LogError($"Failed to read from {fullPath} with exception {e}");
            #endif
            SetDefaults();
        }
    }