Search Issue Tracker

Won't Fix

Votes

10

Found in

2017.2.0p3

Issue ID

975353

Regression

No

Assertion failed on expression: 'm_InstanceID != InstanceID_None' when using UnityWebRequest in an async-loaded Scene

WebRequest

-

Steps to reproduce:
1. Open user attached project
2. Open the "Texture Load Scene" - textures are downloaded
3. Start the Scene
4. Wait 5 seconds, the scene will switch automatically to the "Empty Scene"
5. Wait 5 seconds again, the scene will switch back to the "Texture Load Scene" - textures are redownloaded
6. Notice the InstanceID != InstanceID_None assertions in the console

Expected result: Loading a texture using UnityWebRequest with DownloadHandlerTexture.GetContent(UnityWebRequest) AFTER the scene has loaded with async should redownload the texture successfully.
Actual Result: An InstanceID != InstanceID_None assertion is thrown when the scene is loaded asynchronously and the texture is not loaded.

Reproduced in: 2018.1.0a7, 2017.2.0p3, 2017.2.0a1, 2017.1.2p3, 5.6.4p3

  1. Resolution Note:

    We really appreciate your contribution to the Unity product. Thank you for reporting this issue. We take every case submitted to us seriously by investigating the impact on you, our customer, as well as the impact it may have on the engineering and experience of our product.

    This particular case has been investigated thoroughly and we have decided, in the interests of protecting the stability and features of Unity for users that rely upon the affected versions, to not address this issue.

Comments (4)

  1. cliffordr

    Jun 29, 2018 15:51

    There is a work around for this.

    Cache the texture (static ref or don't destroy instance) as soon as the texture gets downloaded.
    So that even if the Resources.UnloadUnusedAssets is called it doesn't clear the texture in webrequest download handler.

  2. mobfish_cai

    Mar 26, 2018 14:21

    Unity 2017.2.1p2 has this issue.

    Workaround for me while using LoadSceneAsync:
    DO NOT create or send WebRequest during Awake or Start status, send WebRequest after Start(), or pack them inside an IEnumerator Coroutine start with yield return null or waitforseconds.

  3. MaskedMouse

    Dec 22, 2017 21:44

    I found it related to using async scene loading.

    If a scene is loaded synchronous then there is no problem

    But if you load the scene async the first time you use the static getcontent it will fail, if you put the same line of code directly under it, the second time will succeed. It is such a weird issue.

    I have yet to try unity 2017.3f3 to see if the issue reproduces

  4. DAVcoHL

    Dec 19, 2017 17:15

    I have encountered this issue also; it seems to be caused by calling Resources.UnloadUnusedAssets() and/or System.GC.Collect() between downloading the texture and actually getting it from the downloadHandler.

    A workaround is it access the texture using ((DownloadHandlerTexture)www.downloadHandler).texture instead.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.