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
IEnumerator DownloadAvatar() { Debug.LogError("Test 1 "); string[] avatarUrls = new string[] { //URLs }; Debug.LogError("Test 2 "); for (int i = 0; i < avatarUrls.Length; i++) { Debug.LogError("Test 3 "); using (UnityWebRequest www = UnityWebRequest.Get(avatarUrls[i])) { yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.Success) { string filePath = Application.persistentDataPath + "/" + Path.GetFileName(avatarUrls[i]); Debug.LogError("Test 7 "); File.WriteAllBytes(filePath, www.downloadHandler.data); Debug.LogError("Test 8"); string extension = Path.GetExtension(filePath).ToLower(); if (extension == ".bin") { // do something with binary data Debug.LogError("Test 11 "); } Debug.LogError("Test 9 "); if (extension == ".jpg") { Debug.Log("jpg before"); _avatarTex = new Texture2D(2, 2); defaultMat.mainTexture = _avatarTex; _avatarTex.LoadImage(www.downloadHandler.data); Debug.LogError("Test 10 "); } if (extension == ".gltf") { GameObject result = Importer.LoadFromFile(filePath); result.transform.GetChild(0).GetComponent<SkinnedMeshRenderer>().material = defaultMat; result.transform.position = Vector3.zero; Debug.LogError("Test 12 "); } } else { Debug.LogError("Error downloading file: " + www.error); Debug.LogError("Test 6 "); } } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
IEnumerator DownloadAvatar()
{
Debug.LogError("Test 1 ");
string[] avatarUrls = new string[]
{
//URLs
};
Debug.LogError("Test 2 ");
for (int i = 0; i < avatarUrls.Length; i++)
{
Debug.LogError("Test 3 ");
using (UnityWebRequest www = UnityWebRequest.Get(avatarUrls[i]))
{
yield return www.SendWebRequest();
The text was updated successfully, but these errors were encountered: