I make project mesh upload Donwload project and error is occured upload download
uploading succesfully but i don't know downloading
I convet mesh to binary file and upload
I download binary file and convert binary to mesh
2 error
1.I uploaded file but website Gamemanger/content/filemangement is not displayed
2. I download file but I do not know whether it is the correct file or not
i think that is not correct file
the reason is MeshSerializer doesn't work
MeshSerailizer worked fine without upload,download
This is upload cord
public void UploadFileToCDN (string key, byte[] content, string contentType = "binary/octet-stream") { GetUploadUrl(key, contentType, presignedUrl => { PutFile(presignedUrl, content, contentType); }); } void GetUploadUrl(string key, string contentType, Action<string> onComplete) { PlayFabAdminAPI.GetContentUploadUrl(new GetContentUploadUrlRequest() { ContentType = contentType, Key = key }, result => onComplete(result.URL), error => Debug.LogError(error.GenerateErrorReport())); } void PutFile(string presignedUrl, byte[] content, string contentType = "binary/octet-stream") { List<IMultipartFormSection> formData = new List<IMultipartFormSection>(); formData.Add(new MultipartFormDataSection("field1=foo&field2=bar")); formData.Add(new MultipartFormFileSection(content)); UnityWebRequest www = UnityWebRequest.Post(presignedUrl, formData); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Debug.Log("Form upload complete!"); } }
this is cord Download cord
public void DownloadFileFromCDN(string key) { GetDownloadUrl(key, presignedUrl => { MeshSerializer.DeserializeMesh(GetFile(presignedUrl), GetComponent<MeshFilter>().mesh); }); } void GetDownloadUrl(string key, Action<string> onComplete) { PlayFabClientAPI.GetContentDownloadUrl(new GetContentDownloadUrlRequest() { Key = key, ThruCDN = true }, result => onComplete(result.URL), error => Debug.LogError(error.GenerateErrorReport())); } byte[] GetFile(string preauthorizedUrl) { UnityWebRequest www = UnityWebRequest.Get(preauthorizedUrl); // yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); return null; } else { byte[] results = www.downloadHandler.data; return results; } }