public void LoadPlayer(EventInfo eventInfo) { SaveData2 myInfo = GameDataController.GetPlayerState(this); float[] pos = myInfo.Position; Vector3 loadPos; loadPos.x = pos[0]; loadPos.y = pos[1]; loadPos.z = pos[2]; transform.position = loadPos; Velocity = Vector3.zero; }
public void LoadData() { string path = Application.persistentDataPath + "/save.info"; if (File.Exists(path)) { Debug.Log("successful load"); BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); SaveInformation = (SaveData2)formatter.Deserialize(stream); stream.Close(); } //var data = PlayerPrefs.GetString("GameData"); //SaveInformation = JsonUtility.FromJson<SaveData2>(data); }