private void Save() { SaveData data = new SaveData(); data.info = new ScoreInfo(score, level); UseFileInUnity.Save(data, savePath); }
// Start is called before the first frame update void Start() { body = GetComponent <Rigidbody>(); savePath = Application.persistentDataPath + "/" + "score.sav"; SaveData data = (SaveData)UseFileInUnity.Load(savePath); score = data.info.score; level = data.info.level; Debug.Log("Score:" + score + "Level:" + level); }