public bool SaveMap(string path = "") { if (loadedMap == null) { Debug.LogError("No map is currently loaded"); return(false); } if (path == "") { path = EditorUtility.SaveFilePanel( "Save Map", Application.dataPath, loadedMap.name + ".map", "map"); } if (path.Length != 0) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(path); bf.Serialize(file, loadedMap.Export()); file.Close(); loadedMap.name = Path.GetFileNameWithoutExtension(path); } return(true); }