public void writeMusic() { MusicAndSound newMusicAndSound = new MusicAndSound(); newMusicAndSound.sound = sound; newMusicAndSound.music = music; string str2 = JsonUtility.ToJson(newMusicAndSound); PlayerPrefs.SetString("MusicAndSound", str2); }
public void setInfo() { string str2 = PlayerPrefs.GetString("MusicAndSound", null); MusicAndSound musicAndSound = JsonUtility.FromJson <MusicAndSound> (str2); if (musicAndSound != null) { music = musicAndSound.music; sound = musicAndSound.sound; } }
public void setInfo() { string str = PlayerPrefs.GetString("info" + levelId.ToString(), null); string str2 = PlayerPrefs.GetString("MusicAndSound", null); info = JsonUtility.FromJson <LevelInfo> (str); MusicAndSound musicAndSound = JsonUtility.FromJson <MusicAndSound> (str2); if (info != null) { fruits = info.collectedFruits; fruitsNumber = info.fruitsNumber; } if (musicAndSound != null) { music = musicAndSound.music; sound = musicAndSound.sound; } }