static void SaveTextFile(string saveFilePath, string data)
{
string folder = System.IO.Path.GetDirectoryName(saveFilePath);
System.IO.Directory.CreateDirectory(folder);
#if UNITY_WEBPLAYER && !UNITY_EDITOR
Debug.LogError("Current build target is set to Web Player. Cannot perform file input/output when in Web Player.");
#else
System.IO.StreamWriter write = new System.IO.StreamWriter(saveFilePath, false, System.Text.Encoding.UTF8); // Unity's TextAsset.text borks when encoding used is UTF8 :(
write.Write(data);
write.Flush();
write.Close();
write.Dispose();
#endif
}