Beispiel #1
0
    public Mesh Load(string name)
    {
        if (File.Exists(Application.dataPath + "/Resources/" + name + ".mesh"))
        {
            BinaryFormatter bf     = new BinaryFormatter();
            FileStream      stream = new FileStream(Application.dataPath + "/Resources/" + name + ".mesh", FileMode.Open);

            SerializeMesh data = bf.Deserialize(stream) as SerializeMesh;

            stream.Close();
            return(data.GetMesh());//data;
        }
        else
        {
            print("nahhh");
            return(new Mesh());
        }
    }
Beispiel #2
0
    public Mesh Load(string name)
    {
        if (File.Exists(Application.streamingAssetsPath + "/" + name + ".mesh"))
        {
            BinaryFormatter bf = new BinaryFormatter();
            //FileStream stream = new FileStream(Application.streamingAssetsPath +"/"+name+".mesh",FileMode.OpenRead);
            FileStream stream = File.OpenRead(Application.streamingAssetsPath + "/" + name + ".mesh");

            SerializeMesh data = bf.Deserialize(stream) as SerializeMesh;

//        print("loaded");
            stream.Close();
            return(data.GetMesh());//data;
        }
        else
        {
            // print("nahhh");
            return(new Mesh());
        }
    }