Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

App Bundles and loading data from Asset Bundles (performance issue)

Discussion in 'Android' started by imaginalis, Apr 8, 2019.

  1. imaginalis

    imaginalis

    Joined:
    Feb 20, 2015
    Posts:
    29
    Hi, I've just tested App Bundles with my game and levels now load at least 2x slower when using them.

    I'm using Unity 2018.3.11f and Asset Bundles with LZ4 Compression. What I see is that scenes from Asset Bundles load fast but loading additional resources like prefabs takes a lot of time. When I tested with LZMA it loads fast as usual. Is it a known issue or I'm doing something wrong?
     
  2. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
  3. imaginalis

    imaginalis

    Joined:
    Feb 20, 2015
    Posts:
    29
    I'm almost 100% sure it's connected to Asset Bundles used together with App Bundles. We observe the slowdown only when we are loading data from Asset Bundles (both on loading screen and in-game).

    Our temporary workaround is to use LZMA compression instead of LZ4 (which indeed makes it load faster) but when reading:
    https://docs.unity3d.com/540/Documentation/Manual/AssetBundleCompression.html
    I come to a conclusion we should be using LZ4 as we did so far, which is not possible now.

    In our setup we load most of the data from Asset Bundles so it's clearly visible that there's some bug in Unity in this regard.

    Unfortunately I haven't had time to analyze this more.
     
    Tanek likes this.
  4. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
    Looking at the issue, I too was pretty sure about AAB + AB but in the other thread another dev said that they are seeing performance degradation but they don't use AB.
    May be it's a matter of the usage of the texture? I don't know if you checked it but in the other thread I also posted some profiler screenshot.
    So, have you managed to workaround this issue by switching to LZMA? (which as you said and by documentation should be slower instead)
     
  5. imaginalis

    imaginalis

    Joined:
    Feb 20, 2015
    Posts:
    29
    From what I see, guy from that other thread has another issue, which was on S7 only. The issue I have (and probably you as well) can be observed on many devices. I actually could reproduce it on all devices I had at that time.

    Have you received anything from Unity after that bug report you've sent? I'm curious if they managed to reproduce it as well.

    And yes, I'm using LZMA as a workaround now, tested it on my devices and worked fine so far. Though I'm not sure if it's actually a good workaround to this issue, since it needs to be tested on many more devices. In two months we are publishing our game so we'll see but on the other hand I hope there'll be a better solution by that time..
     
  6. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
    Yes, they've confirmed that the bug is known, here's the answer we just received and a possible workaround:
    But:
    a) we are on 2019.1 and we are using (as recommended) the bundled SDK/NDK tools, which has embedded in its name the version number ( \2019.1.8f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\bundletool-all-0.6.0.jar ), I don't think I can update it ( https://github.com/google/bundletool/releases ) without "complains" from Unity ;)
    b) we have asset bundles for multiple platforms, so we can't put all of them directly in /StreamingAssets

    I asked for an issue id to track it and here's the link:
    https://issuetracker.unity3d.com/is...more-time-when-the-project-is-built-as-an-aab
    (just voted of course)
     
  7. imaginalis

    imaginalis

    Joined:
    Feb 20, 2015
    Posts:
    29
    Voted as well now. I hope they put high priority on it :)
     
    Tanek likes this.
  8. imaginalis

    imaginalis

    Joined:
    Feb 20, 2015
    Posts:
    29
    OK, so I've tested today with Unity 2019.2 and it works fine :)

    They've updated bundletool, so that's probably what fixed it.
     
  9. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
    Just tested on Unity 2019.2.2f1 and it doesn't seem fixed for us :(
    Edit: and the issue on the issue tracker is still active.
     
    Last edited: Aug 26, 2019
  10. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    try to rename directories and asset bundles to contain only lower-case letters. That should allow to workaround this issue for now.
     
  11. imaginalis

    imaginalis

    Joined:
    Feb 20, 2015
    Posts:
    29
    Good to know, that's probably why it worked for me in 2019.2.0. I use only lowercase letters for my asset bundle names.
     
  12. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
    Thank you, we are going to test this right now, I'll get back as soon as we have news.
     
  13. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
    Confirmed, this workaround fixes this issue, thank you very much.
     
  14. litebox

    litebox

    Joined:
    Aug 29, 2011
    Posts:
    157
    I integrated Addressables in my project a year ago and since that I had incessant headache with it: problems with obfuscation of Animator's source code, problems with copies of AudioMixer and so on and so on.
    This situation, when levels load 2x-3x time longer was a last straw - most of the time I did tests of debug apk-version of the game and then upload aab to the Google Play Console. And I even didn't realise that on low-end and mid-end Androids my game levels loading time was 20 second instead of 3 second!
    Today I deleted whole Addressables System and returned to the "classic" usage of Prefabs and resources - and now I can focus on gameplay again, not on fighting with the one hundred bugs Addressables introduces into my game.