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()); } }
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()); } }