Search Unity

Bug (Case 1277297) Calling Resources.Load() while asynchronously loading assetbundle makes app freezed

Discussion in '2020.2 Beta' started by Kichang-Kim, Sep 12, 2020.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    623
    Hi. I found app freezing issue related to Resources.Load() and AssetBundles.

    If you calling Resources.Load() while asynchronously loading other assets from AssetBundle by using UnityWebRequest, main thread is freezed.

    This only occurred on Android/iOS device, not Editor. And reproduced by both Unity 2020.2.0b2 and 2020.1.5f1.

    Minimal reproducible project was sent as Case 1277297.
     
    Peter77 likes this.
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,492
    Thanks for the report @Kichang-Kim, we're looking into it.
     
    Kichang-Kim likes this.
  3. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    623
  4. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    623
    I received the response from Unity that "async/await" makes this freezing issue, but I highly doubt it because async/await does not made any special things itself.

    I re-created same reproducible project without async/await and sent modified scripts.

    Also found that calling Resourceds.Load in UnityWebRequestAsyncOperation.completed makes 100% freezing.
     
    LeonhardP likes this.
  5. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    623
    I reported non async/await version of 100% reproducible project as Case 1310359. I hope that this help Unity developers to find and fix freezing issue.
     
  6. ci_playflock

    ci_playflock

    Joined:
    Jul 27, 2020
    Posts:
    4
    Hi!
    We also encountered this problem. Could you please attach a link to Case 1310359 here?
     
  7. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    623
    Unity said 1310359 is merged to 1277297 internally. So you can track ticket status in above link.
     
  8. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,492
    We have a fix for this issue in review. Backport requests for 20.2 and 21.1 are also going to be evaluated.
     
    Kichang-Kim likes this.
  9. ci_playflock

    ci_playflock

    Joined:
    Jul 27, 2020
    Posts:
    4
    Thank you for your reply
    We use the latest lts Unity for production builds. Is there plans to backport the fix to the 2019.4? We have checked versions 2019.4.9-2019.4.20 and we have the problem there. 2019.4.8 works ok, but we need update for Unity IAP and it needs update of the Unity to the latest version.
     
  10. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,492
    Hi @ci_playflock,

    The issue reported by @Kichang-Kim was introduced by changes exclusive to version 20.1 and newer. So what you're experiencing must be a similar yet different problem. Could you please submit a bug report for it with a reproducible attached?
     
  11. ci_playflock

    ci_playflock

    Joined:
    Jul 27, 2020
    Posts:
    4
    Hi, LeonhardP,

    Thank you for your response. We will try to reproduce the bug and will send report
     
    LeonhardP likes this.
  12. CodeBombQuinn

    CodeBombQuinn

    Joined:
    Apr 17, 2018
    Posts:
    20
  13. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,492
    Hi everybody,

    Quick update and correction of my previous statement. We were now able to reproduce the issue reported by @Kichang-Kim in 2019.4 and the fix is being backported. So this might very well be the same problem you're seeing in your projects @ci_playflock @CodeBombQuinn.
     
    CodeBombQuinn and Kichang-Kim like this.
  14. ci_playflock

    ci_playflock

    Joined:
    Jul 27, 2020
    Posts:
    4
    Hi @LeonhardP
    Thank you for your reply! Are there any approximate predictions when the fix will be accepted in 2019.4?
     
    CodeBombQuinn likes this.
  15. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,492
    It was merged to the 19.4 branch two days ago and should be part of the 2019.4.23f1 release.
     
  16. levelappstudios

    levelappstudios

    Joined:
    Nov 7, 2017
    Posts:
    39
    Hi, we are expecting for the update too. There is an issue with our game (Unity 2019.4.21), it's using AssetBundles with async loading resulting in a very long loading times for some devices (Nexus 5X). Maybe could it be related with this case.

    I tried to do a quick switch to Unity 2021 for checking the fix, but some libraries are not compatible so we will wait for the 2019 release.

    I hope it go out soon.
     
  17. CodeBombQuinn

    CodeBombQuinn

    Joined:
    Apr 17, 2018
    Posts:
    20
    Just confirmed Android working for me now on multiple play throughs with 2019.4.23f1! Thanks for the fix!
     
    LeonhardP likes this.
unityunity