More in this category:
using SimpleXmlExtensions;
in your source code.
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using SimpleXmlExtensions;
public class MyExporter {
public void ExportJson(Hashtable aHash) {
string jsonExportString = aHash.JsonString();
ExportToFile(jsonExportString, "SimpleJsonExport.json");
}
private void ExportToFile(string exportString, string path) {
if(exportString == null || path == null) return;
if(Application.platform==RuntimePlatform.OSXPlayer ||
Application.platform==RuntimePlatform.WindowsPlayer &&
Application.platform!=RuntimePlatform.LinuxPlayer || Application.isEditor) {
// We use UTF-8 encoding
byte[] bytes = new UTF8Encoding(true).GetBytes(exportString);
if(File.Exists(path)) File.Delete(path); // delete if it exists
FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
BinaryWriter w = new BinaryWriter(fs);
w.Write(bytes);
w.Close();
fs.Close();
}
}
}