We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
能不能把上传改成异步的?unity里面会卡死
The text was updated successfully, but these errors were encountered:
您好,目前 unity 兼容上可能有比较多问题。暂时不是很推荐直接在 unity 使用。
如果您需要异步上传,可以考虑使用 Task 包装上传部分的逻辑到一个异步函数里面。下面是一个例子:
public Task<HttpResult> ResumeUploadFileV2Task(string filePath, string keyPath) { Mac mac = new Mac(AccessKey, SecretKey); Config config = new Config(); config.UseHttps = true; PutPolicy putPolicy = new PutPolicy(); putPolicy.Scope = Bucket + ":" + keyPath; string token = Auth.CreateUploadToken(mac, putPolicy.ToJsonString()); PutExtra putExtra = new PutExtra(); putExtra.Version = "v2"; ResumableUploader uploader = new ResumableUploader(config); return Task.Run(() => uploader.UploadFile(filePath, keyPath, token, putExtra)); } public async Task UploadFileV2Test() { HttpResult resp = await ResumeUploadFileV2Task("/app/20MB.data", "key/path"); if (resp.Code != (int)HttpCode.OK) { Console.WriteLine("error: " + resp.ToString()); return; } Console.WriteLine("upload success"); }
Sorry, something went wrong.
httpWebRequest是有GetRequestStreamAsync方法的,许多api也都有Async方法了,我把可以异步的全改异步,实测unity是可以完美使用的,不会卡了,咱们也改异步吧
No branches or pull requests
能不能把上传改成异步的?unity里面会卡死
The text was updated successfully, but these errors were encountered: