Last active
January 15, 2018 11:28
-
-
Save nicloay/99b989cc99a2d6facc4d835050e960d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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