private void SaveSplatMap() { // Get file path string path = EditorUtility.SaveFilePanel("Save Terrain Splatmaps", "", "splatmap" + ".xml", "xml"); if (path.Length > 0) { // Get current time for determining how long it takes to save the splatmaps DateTime dt = DateTime.Now; // Get current splatmap tp_Containers.SplatmapContainer tc = new tp_Containers.SplatmapContainer(); tc.SetSplatmap(component.TerrainData.GetAlphamaps(0, 0, component.TerrainData.alphamapWidth, component.TerrainData.alphamapHeight)); // Serialize and save splatmap string file = LoadSave.Serialize(tc); StreamWriter writer = new StreamWriter(path); writer.Write(file); writer.Close(); // Print how long it took to save the splatmaps Debug.Log("Saving splatmap finished! time: [" + (DateTime.Now - dt).ToString() + "]"); } }
private void SaveSplatMap() { // Get file path string path = EditorUtility.SaveFilePanel("Save Terrain Splatmaps", "", "splatmap" + ".xml", "xml"); if (path.Length > 0) { // Get current time for determining how long it takes to save the splatmaps DateTime dt = DateTime.Now; // Get current splatmap tp_Containers.SplatmapContainer tc = new tp_Containers.SplatmapContainer(); tc.SetSplatmap(component.TerrainData.GetAlphamaps(0, 0, component.TerrainData.alphamapWidth, component.TerrainData.alphamapHeight)); // Serialize and save splatmap string file = LoadSave.Serialize(tc); StreamWriter writer = new StreamWriter(path); writer.Write(file); writer.Close(); // Print how long it took to save the splatmaps Debug.Log("Saving splatmap finished! time: [" + (DateTime.Now - dt).ToString() + "]"); } }