Ejemplo n.º 1
0
    public static void savePosOfCam(testSaving player)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        //string path = Application.persistentDataPath + "/player.save";
        string     path   = Application.persistentDataPath + "/player.save";
        FileStream stream = new FileStream(path, FileMode.Create);

        posSave data = new posSave(player);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Ejemplo n.º 2
0
    public static posSave loadPosOfCam()
    {
        string path = Application.persistentDataPath + "/player.save";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);

            posSave data = formatter.Deserialize(stream) as posSave;
            stream.Close();

            return(data);
        }
        else
        {
            Debug.LogError("Save File Not Found in " + path);
            return(null);
        }
    }