Skip to content
New issue

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

Error during runtime loading texture from StreamingAssets #56

Closed
lloyar opened this issue Feb 17, 2020 · 0 comments
Closed

Error during runtime loading texture from StreamingAssets #56

lloyar opened this issue Feb 17, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@lloyar
Copy link

lloyar commented Feb 17, 2020

LogError:
GLTFImage.cs ToTexture2D() ERROR: Cannot connect to destination host

My code:

string path = Application.streamingAssetsPath;
Importer.LoadFromFile(path + "/Lantern/glTF/Lantern.gltf");

My file:
Lantern.zip

Error code:

#if !UNITY_EDITOR && ( UNITY_ANDROID || UNITY_IOS )
    path = "File://" + path;
#endif
    // TODO: Support linear/sRGB textures
    using(UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(path, true))
    {
        UnityWebRequestAsyncOperation operation = uwr.SendWebRequest();
        float progress = 0;
        while (!operation.isDone)
        {
            if (progress != uwr.downloadProgress)
            {
                if (onProgress != null) onProgress(uwr.downloadProgress);
            }
            yield return null;
        }

        if (onProgress != null) onProgress(1f);

        if (uwr.isNetworkError || uwr.isHttpError)
        {
            Debug.LogError("GLTFImage.cs ToTexture2D() ERROR: " + uwr.error);
        } 
        else
        {
            Texture2D tex = DownloadHandlerTexture.GetContent(uwr);
            tex.name = Path.GetFileNameWithoutExtension(path);
            onFinish(tex);
        }
        uwr.Dispose();
    }
@Siccity Siccity added the bug Something isn't working label Feb 17, 2020
birdinforest added a commit to birdinforest/GLTFUtility that referenced this issue Jul 11, 2020
@lloyar lloyar closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants