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

Bug Cant get asset bundle with addressable on WebGL - 2022.1.0f1

Discussion in 'WebGL' started by Wasp3r, Nov 25, 2022.

  1. Wasp3r

    Wasp3r

    Joined:
    Dec 6, 2020
    Posts:
    7
    Hi,

    I have a problem with using addressable on my WebGL build. It worked fine on Unity version 2020.3.33f1 but stopped working on 2022.1.0f1 and higher. It works fine when I build it for Windows.
    I'm pretty sure, that it's not the fault of the addressable version, because I've downgraded it to the same as I used in the older version of unity (1.19.17) and it didn't help. This issue is also occurring on the new projects.

    The error looks like this:
    It's also worth mentioning, that I can download bundles from the URLs above with no issue and they seem to be totally fine.

    Unity version: 2022.1.0f1, 2022.2.0b15
    Addressable version: 1.19.17, 1.21.1
    Platform: WebGL
     
    Last edited: Nov 25, 2022
    DannyWebbie likes this.
  2. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
    After spending a whole day debugging the same issue I've found what is going wrong.
    The issue is that WebGL build is unable to load bundle if its name ends with ".bundle".
    This is what Unity's "production quality" is. :)

    So it may be the WebGL team's guilt, because they can't load ".bundle".
    Or it may be the Addressables team's guilt, because they name their bundles with ".bundle".
    I guess, they need to resolve this on a boxing ring - the side who loses fixes the bug. :)

    I've tested bundles with no extension or ".package" extension - they load fine. But as soon as you name it ending with ".bundle" - it won't. I've submitted a bug report, so my civic duty is fulfilled.

    If this issue is critical to you, your best bet is to patch the Addressables package to replace all ".bundle" to ".package".
    Or just wait for Unity to fix this.
     
    DannyWebbie likes this.
  3. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
    Ok, it seems it has to do something with Cache API. If you remove ".bundle" check in output.loader.js, it seems to fix this. So there is a chance for a workaround.
    upload_2022-12-4_0-8-35.png
     
    DannyWebbie likes this.
  4. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
    Finally solved it.

    This is how a part of loader.js looks like:
    2022-12-04_02-02-45.png

    And this is how it should look:
    2022-12-04_02-01-43.png
     
    DannyWebbie likes this.
  5. DannyWebbie

    DannyWebbie

    Joined:
    Jun 5, 2018
    Posts:
    7
  6. Wasp3r

    Wasp3r

    Joined:
    Dec 6, 2020
    Posts:
    7
    DannyWebbie likes this.