Search Unity

[0.7.4] Addressables - Built in shaders compressed using wrong algorithm in WebGL builds

Discussion in 'Addressables' started by ulfchristensen, Apr 25, 2019.

  1. ulfchristensen

    ulfchristensen

    Joined:
    Oct 26, 2017
    Posts:
    6
    When creating a WebGL build using Addressable assets, it seems that all standard shaders used are gathered from the various bundles and added to a bundle named: <default_assets>_unitybuiltinshaders_<GUID>.bundle
    This bundle is then compressed using LZMA.

    The first part seems to be working but LZMA compression does not work with WebGL.

    Is there a way to specify what algorithm to use for the builtin shader bundle or is this a bug in the Addressable system?
     
  2. Initive

    Initive

    Joined:
    Jan 26, 2013
    Posts:
    10
    Seems like a regression. For now I've reverted to 0.6.8 which works fine.
     
  3. ulfchristensen

    ulfchristensen

    Joined:
    Oct 26, 2017
    Posts:
    6
    *BUMP*

    As this breaks any WebGL build using Unity Builtin Shaders it seems to be a major issue to me.

    Is there any resolution to this?
     
  4. Initive

    Initive

    Joined:
    Jan 26, 2013
    Posts:
    10
  5. ulfchristensen

    ulfchristensen

    Joined:
    Oct 26, 2017
    Posts:
    6
    That might work if you're not actually using the shaders (we are).

    It's also possible to hack the addressable code and force LZ4 compression on the bundle. That works like a charm. Unfortunately this code is part of the Package Manager package and doesn't migrate through SCM which creates a massive administrative overhead when you have multiple seats working on the same project and/or use buildserver(s) for final build and deployment.
     
  6. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Thanks for letting us know, we'll look into it.
     
  7. Twyker_gp

    Twyker_gp

    Joined:
    Dec 4, 2018
    Posts:
    29
    +1
    Can confirm it's a problem in WebGL decompressing the builtinshaders in any post 0.6.8 version of the addressables.
     
  8. wkroeker

    wkroeker

    Joined:
    Sep 25, 2018
    Posts:
    2
    +1
    Still an issue in 1.1.4.
     
  9. wangyucheng1992

    wangyucheng1992

    Joined:
    Feb 19, 2019
    Posts:
    59
    Hi bill, if i do Addressables.LoadAssetAsync("Cube") to get asset at Start(), then I want to Instantiate the Cube per 2s, so i do Addressables.LoadAssetAsync("Cube") per 2s, I want to know :
    • In the underlying code, whether the Cube Asset need to be reloaded before instantiation per time?
     
  10. wkroeker

    wkroeker

    Joined:
    Sep 25, 2018
    Posts:
    2
    Hi everyone,

    a temporary fix that worked for us in version 1.1.4 is to replace the following return statement in the function GetCompressionForIdentifier():
    Code (CSharp):
    1. return base.GetCompressionForIdentifier(identifier);
    with:
    Code (CSharp):
    1. return BuildCompression.LZ4Runtime;
    in the file: Packages/Addressables/Editor/Build/DataBuilders/AddressableAssetsBundleBuildParameters.cs

    The problem is that there is no default bundled asset group associated with the built in shaders and the default compression is BuildCompression.LZMA which can't be decompressed in WebGL builds.
     
  11. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
    You actually can import package code into the packages folder directly, and commit it to your VCS. If you just keep the name of the package, it will be detected as normal. I routinely modify packages. You have to be diligent on how you commit your modifications, to make it easy to update when needed. What I do is that I commit the unmodified package on some revision then make my changes on a separate commit. Then when I need to upgrade, I update back to that VCS revision, delete the local version, update the package, copy new new one in commit and merge the changes back in. It more than a button click but still quite a reasonable process.
     
    unity_bill likes this.