- Home /
Question by
ExtelSolution · Oct 19, 2017 at 07:09 AM ·
wwwdownload
Get size of an zip file from server and progress in Kb?
I want to download a zip file from my server and show progress bar in kb/s or mb/s
i have implemented this code:
private IEnumerator DOWNLOADZIP(string URL)
{
ShowText.SetActive (true);
showpath.GetComponent<Text>().text = "Downloading...";
WWW www = new WWW (URL);
while( www.progress < 1 )
{
float m_CurrentValue = www.progress * 100;
Debug.Log( string.Format( "Progress - {0}%. from {1}", www.progress * 100, www.url ) );
yield return new WaitForSeconds( .1f );
}
yield return www;
byte[] data = www.bytes;
File.WriteAllBytes (BookPath + "/Book02.zip" , data);
if (File.Exists (zipPath) == false) {
Debug.LogError (zipPath + " is not found!");
System.Diagnostics.Process.Start (Path.GetDirectoryName (zipPath));
} else {
showpath.GetComponent<Text> ().text = "Download Complete.";
PlayerPrefs.SetString ("Book02_Download4", "true");
ZipUtil.Unzip (zipPath, BookPath);
Activity.GetComponent<Button> ().enabled = true;
SingAlong.GetComponent<Button> ().enabled = true;
}
May be similar to this thread i want....
Can you help with this @PhiseG1
Comment
i want this method with progress bar
http://answers.unity3d.com/questions/1035361/get-size-of-an-online-assetbundle-and-progress-in.html
Your answer
Follow this Question
Related Questions
Why does nothing happen after yield return www 0 Answers
WWW Downloaded file 1 Answer
Is it possible to download a youtube video from unity 3 Answers
DownloadHandlerAudioClip compressed and streamAudio properties 0 Answers
www.texture memory leak 1 Answer