public void SaveIt() { if (inputMesh == null) { inputMesh = GameObject.FindGameObjectWithTag("Mesh").GetComponent <MeshFilter> ().mesh; } if (inputMesh != null) { save.Play(); var fullFileName = Application.dataPath + "/" + fileName; MeshSerializer.WriteMeshToFile(inputMesh, fullFileName, saveTangents); Debug.Log("saved " + name + " mesh to " + fullFileName); } }
void Start() { string path = "Assets/Resources/Meshes/"; try { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } } catch (IOException e) { Debug.LogError(e.Message); } Mesh inputMesh = GetComponent <MeshFilter>().mesh; string fullFileName = path + fileName; MeshSerializer.WriteMeshToFile(inputMesh, fullFileName, saveTangents); Debug.LogError("Saved " + name + " mesh to " + fullFileName); }