问题
Trying to download a file from firebase storage.
Works very good but my progress does not get updated "live".
When I Debug.Log my progress, all the debug messages are printed in the console when the download is completed and not while the download is in progress.
At work, where my internet connection is way better, it looks as if it works as expected but at home I have this strange behaviour.
public void DownloadFile(string destination, string filename, StorageProgress<DownloadState> handleProgress, Action<Task> completionBlock)
{
CTRouter.MyContentReference(uid, cid)
.Child(filename)
.GetFileAsync(destination, handleProgress, CancellationToken.None)
.ContinueWith(resultTask =>
{
completionBlock(resultTask);
});
}
In my handleProgress method I Debug.Log the progress and update a progress bar in the UI.
Is there a threading problem or something? Why the progress bar gets updated with good internet but not when there is only 2 MBit internet? its downloading and nothing happens. when download completes, I get spammed with all the progress logs and my progress bar goes to 100%.
Any help would be great. Thanks!
Edit: I tried the code from the quickstart-unity repository and got the same problem (DownloadFileAsync and DownloadStreamAsync) but the download seems to freeze the UI and console until the download is completed. After it completes, I get spammed with all the progress update messages. So I think there is a bug in the unity firebase SDK? I'm using Unity 2017.3.1f1 and latest Firebase SDK. Also tried it with Unity 5.3.5 and it's not working.
Any help?
回答1:
I filed a bug report and asked the support for help. This behaviour is indeed a bug and will be fixed within the next Firebase Unity SDK release.
来源:https://stackoverflow.com/questions/49225307/firebase-storage-download-file-with-progress-does-not-fire-live-unity-c