public PlayerData(playerLevelInfo player) { level = player.level; //time = player.time; position = new float[3]; position[0] = player.transform.position.x; position[1] = player.transform.position.y; position[2] = player.transform.position.z; }
public static void SavePlayer(playerLevelInfo player) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/player_info"; FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(player); formatter.Serialize(stream, data); stream.Close(); }