Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IEnumerator PartlyDownload()
- {
- string url = connectionConfig.ImagesNameListEndpoint;
- Debug.Log(Application.persistentDataPath);
- string vidSavePath = Path.Combine(Application.persistentDataPath, "list");
- vidSavePath = Path.Combine(vidSavePath, "MyList.txt");
- //Create Directory if it does not exist
- if (!Directory.Exists(Path.GetDirectoryName(vidSavePath)))
- {
- Directory.CreateDirectory(Path.GetDirectoryName(vidSavePath));
- }
- DownloadHandler downloadHandler = new DownloadHandlerFile(vidSavePath);
- var download = new UnityWebRequest(url, UnityWebRequest.kHttpVerbGET, downloadHandler, null);
- int resumeOffset = 131;
- var rangeHeader = "bytes=" + resumeOffset + "-";
- download.SetRequestHeader("Range", rangeHeader);
- yield return download.SendWebRequest();
- if (download.isNetworkError || download.isHttpError)
- Debug.Log(download.error);
- else
- Debug.Log("Success");
- }