IEnumerator GetImages() { foreach (var result in results) { GoogleDriveFiles.DownloadTextureRequest request; request = GoogleDriveFiles.DownloadTexture(result.Key); request.Send().OnDone += ImageRequested; yield return(requestFilled); } }
private async UniTask <byte[]> DownloadFileAsync(UnityGoogleDrive.Data.File fileMeta) { if (useNativeRequests) { if (typeof(TResource) == typeof(AudioClip)) { downloadRequest = GoogleDriveFiles.DownloadAudio(fileMeta.Id, WebUtils.EvaluateAudioTypeFromMime(fileMeta.MimeType)); } else if (typeof(TResource) == typeof(Texture2D)) { downloadRequest = GoogleDriveFiles.DownloadTexture(fileMeta.Id, true); } } else { downloadRequest = new GoogleDriveFiles.DownloadRequest(fileMeta); } await downloadRequest.SendNonGeneric(); if (downloadRequest.IsError || downloadRequest.GetResponseData <UnityGoogleDrive.Data.File>().Content == null) { Debug.LogError($"Failed to download {Path}{usedRepresentation.Extension} resource from Google Drive."); return(null); } if (useNativeRequests) { if (typeof(TResource) == typeof(AudioClip)) { loadedObject = downloadRequest.GetResponseData <UnityGoogleDrive.Data.AudioFile>().AudioClip as TResource; } else if (typeof(TResource) == typeof(Texture2D)) { loadedObject = downloadRequest.GetResponseData <UnityGoogleDrive.Data.TextureFile>().Texture as TResource; } } return(downloadRequest.GetResponseData <UnityGoogleDrive.Data.File>().Content); }
private void DownloadTexture() { request = GoogleDriveFiles.DownloadTexture(fileId, true); request.Send().OnDone += RenderImage; }
// Download texture from Google Drive private void DownloadTexture(string id) { isDownloadind = 1; requestTexture = GoogleDriveFiles.DownloadTexture(id, true); requestTexture.Send().OnDone += RenderImage; }
void DownloadTexture(string fileId) { texReq = GoogleDriveFiles.DownloadTexture(fileId); texReq.Send().OnDone += RenderImage; }