My settings.json (generated with JsonUtility.ToJson):
{
"masterVolume": 0.10000000149011612,
"fullScreenMode": 1,
"cheatsEnabled": false
}
Offending line:
SettingsData sd = JsonUtility.FromJson<SettingsData>(Application.dataPath + "/Settings/settings.json");
My SettingsData-class.
[System.Serializable]
public class SettingsData
{
[SerializeField]public float masterVolume;
[SerializeField]public int fullScreenMode;
[SerializeField]public bool cheatsEnabled;
public SettingsData(float masterVolume, FullScreenMode fullScreenMode, bool cheatsEnabled)
{
this.masterVolume = masterVolume;
this.fullScreenMode = (int)fullScreenMode;
this.cheatsEnabled = cheatsEnabled;
}
}
I really can't fathom why it's having trouble reading this back in, I even tried to save the enum as an int instead, but still no luck.