agens-no/PolyglotUnity

Google Download doesn't work in older Unity versions like 5.6

runevision opened this issue · 3 comments

The download from Google sheet functionality doesn't work for me in Unity 5.6, either with the master sheet or the custom sheet. The progress never goes beyond 0. It does work in Unity 2018.3.

Canceling the progress bar for some reason doesn't work so I had to force quit Unity for every attempt. To address this I added some timeout code.

        float lastProgress = 0;
        System.DateTime lastProgressTime = System.DateTime.Now;
        while (!www.isDone)
        {
            #if UNITY_5_5_OR_NEWER
            var progress = www.downloadProgress;
            #else
            var progress = www.progress;
            #endif
            if (progressbar != null && progressbar(progress))
            {
                done(null);
                yield break;
            }

            if (progress > lastProgress)
            {
                lastProgress = progress;
                lastProgressTime = System.DateTime.Now;
            }
            if ((System.DateTime.Now - lastProgressTime).TotalSeconds > 10)
            {
                Debug.LogError("Google sheet timed out.\nURL:" + url);
                done(null);
                yield break;
            }

            yield return null;
        }

Furthermore, to make the progress bar go away when an error happens, I had to add a EditorUtility.ClearProgressBar(); call in the DownloadComplete method in LocalizationEditor.cs.

However, these progress bar workarounds don't address the core issue that the localization data can't be downloaded in the first place.

Hey Rune! Thank you for taking the time and testing this feature. This plugin does not support google sheets that isn't public. Could you maybe try again with a sheet that is publicly shared if you hadnt already? Also, I'd love to see any PR's that improve the messaging around that feature.

edit: Finally saw the stuff about this being version 5.6 and it working in the latest. I'll download 5.6 and test

This should be fixed in 7aee54a

It works now with the fix in 7aee54a. Thanks a lot!