public void Save() { PlayerPrefs.SetInt("CurrentSkin", Instance.currentSkinIndex); PlayerPrefs.SetInt("Currency", Instance.currency); SkinAvailabilitySave skinSave = new SkinAvailabilitySave(); skinSave.data = skinAvailability; string skinsJson = JsonUtility.ToJson(skinSave); //Debug.Log (skinsJson); //Debug.Log (JsonUtility.ToJson (Instance)); PlayerPrefs.SetString("SkinAvailability", skinsJson); }
private void Awake() { instance = this; DontDestroyOnLoad(gameObject); if (PlayerPrefs.HasKey("CurrentSkin")) { currentSkinIndex = PlayerPrefs.GetInt("CurrentSkin"); currency = PlayerPrefs.GetInt("Currency"); SkinAvailabilitySave skinSave = JsonUtility.FromJson <SkinAvailabilitySave>(PlayerPrefs.GetString("SkinAvailability")); this.skinAvailability = skinSave.data; } else { Save(); } }