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

Addressable scene works slower then non-addressable even with LZMA compression

Discussion in 'Addressables' started by unity_OSeBXw9aivkTJg, Feb 5, 2021.

  1. unity_OSeBXw9aivkTJg

    unity_OSeBXw9aivkTJg

    Joined:
    Jul 8, 2019
    Posts:
    19
    Hey, we are trying to migrate our scenes to be addressable in order to reduce the APK size for Android.

    For some reason, the scenes work a lot slower on low-end devices, and sometimes even completely freeze. Before addressables, the scenes worked fine. We have deliberately used the LZMA compression, because as far as I understand - in that case, the addressable group which contains a single scene would be compressed in one chunk, and after that completely decompressed before launching. If I am correct, after the scene is loaded, addressables shouldn't add any overhead - because the scene is already fully decompressed, but for some reason, there is a performance penalty.

    We are loading the scene by using Addressables.LoadSceneAsync, and the scene that we are testing is using local load and build path. So I am interested what overhead do addressable bring in this scenario and how to overcome it?
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
    Let me flag this for the team to share some guidance. Which version of Addressables are you using currently?
     
  3. unity_OSeBXw9aivkTJg

    unity_OSeBXw9aivkTJg

    Joined:
    Jul 8, 2019
    Posts:
    19
    1.8.5, and Unity version 2020.1.9f1. Thanks!
     
  4. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
    Thanks. I'll let you know if the team has any input. I will say, though, that you're using a fairly old version of Addressables.
     
  5. unity_OSeBXw9aivkTJg

    unity_OSeBXw9aivkTJg

    Joined:
    Jul 8, 2019
    Posts:
    19
    We have now migrated to Unity 2020.1.17 and Addressable 1.16, and still see a performance hit.
     
  6. oliviergc

    oliviergc

    Unity Technologies

    Joined:
    Dec 19, 2019
    Posts:
    26
    For optimal loading time, LZ4 is the suggested compression method when your content is built locally. LZMA compression should only be used for online content.

    A warning about this should be displayed in the console in Addressables version 1.13.1+.

    Try setting the compression to LZ4 and see if you still get a performance hit.

    Reference in the documentation.
     
  7. unity_OSeBXw9aivkTJg

    unity_OSeBXw9aivkTJg

    Joined:
    Jul 8, 2019
    Posts:
    19
    We use LZMA for scenes that are loaded from CDN, and we have performance issues with them?
     
  8. oliviergc

    oliviergc

    Unity Technologies

    Joined:
    Dec 19, 2019
    Posts:
    26
    Oh. I know we made some performance improvements in 1.13.1 for Android when loading from local paths, but if you also see a performance hit with scenes loaded from CDN then your problem may be something different. I'll investigate a bit further and get back at you as soon as possible.
     
  9. unity_OSeBXw9aivkTJg

    unity_OSeBXw9aivkTJg

    Joined:
    Jul 8, 2019
    Posts:
    19
    Ok thanks.

    BTW what is the best configuration for addressable groups which are loaded from CDN and contain the whole scenes(1 scene 1 group). We are currently using LZMA, pack separately and CRC turned off. Is that the most optimal setting?
     
  10. oliviergc

    oliviergc

    Unity Technologies

    Joined:
    Dec 19, 2019
    Posts:
    26
    This sounds like a good setup. LZMA is the best for remote content because it is smaller to download. When downloaded, caching will recompress the bundle to uncompressed or LZ4 depending on the Caching.compressionEnabled.

    It is best to disable CRC for cached bundles, unless you have sensitive data such as game settings (so sometimes it can be good to have those in another bundle with crc enabled for cache if so). CRC should be disabled for local bundles. When caching the download, the CRC is calculated during the caching process, so there is no extra overhead when it is being downloaded.
     
    Last edited: Feb 23, 2021
  11. oliviergc

    oliviergc

    Unity Technologies

    Joined:
    Dec 19, 2019
    Posts:
    26
    As for your specific problem, if you could submit a ticket to support with a repro project, or at the very least a bundle that is super slow to load, and by specifying what model device you use, it would really be appreciated and help us investigate the issue.
     
  12. unity_OSeBXw9aivkTJg

    unity_OSeBXw9aivkTJg

    Joined:
    Jul 8, 2019
    Posts:
    19
    We cannot submit a repro project, because it is a released app.

    Just to make sure you understood our issue - it's not the initial loading time that is the problem, the issue is that the game just works considerably slower when playing through addressable scene. We have compared the same scene side by side(addressable vs not addressable) and it is definitely slower - we have frame drops all over the place. What is the additional work that the addressables are doing after the addressable scene is loaded? As I've said, we are testing this in setup - one addressable scene - one addressable group.
     
  13. oliviergc

    oliviergc

    Unity Technologies

    Joined:
    Dec 19, 2019
    Posts:
    26
    Sorry I indeed misread your post.

    As soon as the scene is loaded, there really shouldn't be any differences between running a scene loaded via Addressables vs not-Addressables.

    I've asked around in my team and the only potential overhead that could affect it is if there are a bunch of dependency bundles that need to load as well when the scene is running.

    I still recommend you try experimenting with the compression setting. LZMA is going to be the fastest to download because of its size, but the slowest to load - it has to recompress into LZ4 after downloading. This recompression won't occur if the bundle compression is already LZ4.

    Apparently it is known that Android loading from bundles is slow. It actually depends on the device. Some are faster using load from file, other are faster using unity web request.

    If your problem still persist and if you are unable to provide a sample project, would it be possible to provide a profile capture for the game when using an Addressable scene vs non addressable?
     
    Last edited: Feb 24, 2021