public void Save <U>(U saveObject, out string saveText) { StringBuilder nameSave = new StringBuilder(); nameSave.Append(prefixSave); nameSave.Append(myType.ToString()); nameSave.Append(SaveController.GetNumSave()); string serialized = JsonUtility.ToJson(saveObject); saveText = serialized; }
public void Save <U>(U saveObject) { StringBuilder nameSave = new StringBuilder(); nameSave.Append(prefixSave); nameSave.Append(myType.ToString()); nameSave.Append(SaveController.GetNumSave()); string serialized = JsonUtility.ToJson(saveObject); PlayerPrefs.SetString(nameSave.ToString(), serialized); }
public void Load <U>(ref U loadObject) { StringBuilder nameSave = new StringBuilder(); nameSave.Append(prefixSave); nameSave.Append(myType.ToString()); nameSave.Append(SaveController.GetNumSave()); if (PlayerPrefs.HasKey(nameSave.ToString())) { string serialized = PlayerPrefs.GetString(nameSave.ToString()); loadObject = JsonUtility.FromJson <U>(serialized); } }
public void InitObject() { myType = this.GetType(); SaveController.AddObj(this); }