Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bugs encountered getting Addressables working with WebGL (Addressables 0.6.7/Unity 2019.1.b5)

Discussion in 'Addressables' started by dthurn, Mar 23, 2019.

  1. dthurn

    dthurn

    Joined:
    Feb 17, 2015
    Posts:
    77
    Hi folks, I've been trying to set up a "hello world" project showing how to use Addressable assets with WebGL. I've encountered a few bugs following the default Editor Hosting setup, which I thought I'd report here:

    1) Spaces in file names do not work correctly -- the game will attempt to url-escape the spaces, but I think the hosting server strips them, so you'll get an error like this at runtime:

    Code (csharp):
    1. Exception: RemoteAssetBundleProvider unable to load from url http://192.168.1.11:65115/Default%20Group_UnityBuiltInShaders_891d21c50fffba2cb82060e523f43278.bundle, result='HTTP/1.1 404 Not Found'.
    Renaming to "DefaultGroup" fixes this problem

    2) Using the "Strip Engine Code" option breaks addressables

    This build option (which is enabled by default and is quite important for targeting the web) breaks stuff in Addressables. You get errors like this when it is enabled:

    Not sure how to debug this further to identify which thing is being stripped

    3) Development server does not serve the site with the correct CORS headers

    By default, it is not possible to download asset bundles from a different origin (the cross-origin-resource-sharing policy). It is possible to set headers such that the editor web server can fetch data from the editor bundle hosting server, but Unity does not set the headers correctly by default. Browsers have ways of disabling this for local development, but it's kind of an annoyance. You get errors like this by default:

    I've attached the project setup I'm using for this -- please let me know if I'm doing anything wrong on my side.
     

    Attached Files:

    Elringus and MNNoxMortem like this.