Skip to content

Instantly share code, notes, and snippets.

@nicloay
Last active January 15, 2018 11:28
Show Gist options
  • Save nicloay/99b989cc99a2d6facc4d835050e960d8 to your computer and use it in GitHub Desktop.
Save nicloay/99b989cc99a2d6facc4d835050e960d8 to your computer and use it in GitHub Desktop.
using System.IO;
using UnityEditor;
using UnityEngine;
public class SyncTranslations
{
private static string _destFile = "Assets/Resources/Translations.txt";
private static string _url =
"https://docs.google.com/spreadsheets/d/xxxx/export?format=tsv&id=xxxx&gid=0";
private WWW www;
[MenuItem("Window/SyncTranslations")]
public static void DownloadTranslations()
{
var syncer = new SyncTranslations();
}
public SyncTranslations()
{
www = new WWW(_url);
EditorApplication.update += EditorUpdate;
}
void EditorUpdate()
{
if (www.isDone)
{
Debug.Log("Sync done");
File.WriteAllText(_destFile, www.text);
www.Dispose();
www = null;
EditorApplication.update -= EditorUpdate;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment