/// <summary>
    /// Loads a mesh from a binary dump
    /// </summary>
    public static Mesh MeshUndump(string meshPath)
    {
        System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
        System.IO.FileStream fs  = new System.IO.FileStream(meshPath, System.IO.FileMode.Open);
        SerializableMeshInfo smi = (SerializableMeshInfo)bf.Deserialize(fs);
        Mesh mesh = smi.GetMesh();

        fs.Close();
        return(mesh);
    }
Esempio n. 2
0
    public void MeshUndump()
    {
        if (!System.IO.File.Exists(Application.dataPath + "meshFile.dat"))
        {
            Debug.LogError("meshFile.dat file does not exist.");
            return;
        }
        System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
        System.IO.FileStream fs  = new System.IO.FileStream(Application.dataPath + "meshFile.dat", System.IO.FileMode.Open);
        SerializableMeshInfo smi = (SerializableMeshInfo)bf.Deserialize(fs);

        loader.GetComponent <MeshFilter>().mesh = smi.GetMesh();
        fs.Close();
    }