IEnumerator DownloadVolumetricContentProcess(ImmersivItems item) { if (StorageManager.HasVolumetricContent(item.itemsData.video)) { OpenDownloadVolumetricContentProcess(false); yield break; } OpenDownloadVolumetricContentProcess(true); wwwVolumetric = UnityWebRequest.Get(item.itemsData.video); wwwVolumetric.SendWebRequest(); while (!wwwVolumetric.isDone) { DisplayDownloadVolumetricContentProcess(wwwVolumetric.downloadProgress); yield return(null); } if (wwwVolumetric.isNetworkError || wwwVolumetric.isHttpError || !string.IsNullOrWhiteSpace(wwwVolumetric.error)) { // Download fail Debug.Log(wwwVolumetric.error); } else { // Download success string newPath = Path.Combine(StorageManager.VolumetricContentPath, StorageManager.GetFileName(item.itemsData.video)); File.WriteAllBytes(newPath, wwwVolumetric.downloadHandler.data); item.OnClickItems(); } wwwVolumetric.Dispose(); OpenDownloadVolumetricContentProcess(false); }
public void DownloadVolumetricContent(ImmersivItems item) { StartCoroutine(DownloadVolumetricContentProcess(item)); }