Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

AudioClips not playing in WebGL when downloaded with AssetBundles

Discussion in 'Web' started by GuyTidhar, Jan 1, 2016.

  1. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    AudioClips not playing in WebGL when downloaded with AssetBundles
    Unity 5.2.3 or 5.3.1,

    WebGL audio clips rom AssetBundles seems to be firing: "Error: Cannot create FMOD::Sound instance for resource archive:/CAB-.../CAB-....resource, (Unsupported file or audio format. )".

    These audio clips have no problem to be played when they're part of the build, but produce the above fantastic error.

    Anyone knows what's this about?
     
  2. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
  3. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    Anyone got a clue? Unity support?
     
  4. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    Are you sure you've build/use webgl audio bundles? Webgl doesn't use fmod afaik.
     
  5. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    Positive.

    And Unity has some abstraction layer that simulates as if it was FMOD.
     
  6. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    An update:

    This works in the actual WebGL build running in the browser but not in the editor.

    So does this means I can not use the WebGL asset bundles in the editor?
     
  7. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Asset bundles may, or may not, be compatible between platforms. I would recommend you to use asset bundles for Standalone in the Editor.
     
  8. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    Thanks.

    As it seems a number of issue has raising up regarding asset bundles derivatives I might do so (though this is certainly not ideally as it means more development time for the development environment only).
     
  9. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Marco, are you saying that WebGL assetbundles may not load properly in an editor (with WebGL platform targeted) ? Is this specific to audio or any assets?
     
  10. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    I'm pretty sure it's a general thing.
     
  11. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Either way, is this not a bug? The Unity Editor should know how to download/process assetbundles for its current target properly. I dont recall having this issue with the webplayer platform.
     
  12. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    I think it is and should be regarded as a bug.
    Unity being able to give you the ability to test 90%+ of your work in editor is one of the biggest pluses of this platform.
    If they are letting this loose, I think this will pile up to major difficulties and overhead to develop.

    I already have an issue with a third party font plugin that does no work in the editor, basically making me unable to read anything printed in the game in editor mode. Needing to fix that is a horrible overhead.
     
  13. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Agreed. Ive found numerous threads on this topic and it all seems to come back to this issue in the editor.

    http://forum.unity3d.com/threads/st...ally-wrong-after-building-assetbundle.346306/
    http://forum.unity3d.com/threads/shadervariantcollection-how-does-it-work.337081/
    http://forum.unity3d.com/threads/lo...les-makes-assets-appear-pink-in-editor.326541

    I have at least one bug report on this issue from a shader/materials stand point and I believe there are others out there. I have not heard from QA regarding it, however.
     
  14. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    I'm not sure that this should be regarded as a bug; the assetbundles for webgl (or for android/iOS) have very different compiled shaders and for webgl the audio is not played with FMOD but with the WebAudio API.

    So that means that the editor should be able to mimic the behaviour of a browser to play the audio to have any meaning qua testing; or to play the game even, because the runtime behaves differently depending on the browser.

    It's better to build standalone assetbundles and use those in the editor. In fact, it might even be better to not use assetbundles in the editor at all.
     
  15. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    I have to disagree. The main concern of the development is producing a certain flow of data to the player. The technical changes between each platform are irrelevant to that concern. This is the strongest point of what Unity is all about - best game cross-platform development in the market.
     
    lloydsummers and sirrus like this.
  16. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Yes. If you check "Platform compatibility for AssetBundles" table in the manual, asset bundles built for platform X might work in the editor but specific type of assets might not be compatible.

    So, if you built a webgl asset bundle, and an asset fails to load in a webgl build, that's definitely a bug. If it fails in the editor, it depends. For example, if a shader does not work in the editor that renders using DX9/11, then that's expected.
     
  17. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Marco,

    Thanks for the response. I guess that is understandable but very disappointing for our workflow. That documentation should probably be updated with all current platforms, though, to note the incompatibilties.
     
  18. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I understand that is not convenient, especially if you were used to deploy to the WebPlayer, which did not have this problem. Maybe that's something we can look at in the future, although it might be tricky. For example, in terms of audio assets, Unity WebGL uses AAC format which is not readable by FMOD.

    I agree. We'll get that updated.
     
  19. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    @Marco Trivellato could you tell us how the correct workflow should be for building assetbundles with shaders for Standalone which are compatible on Windows and OSX? There is a problem when using the Standalone assetbundles in the editor and we couldn't figure out how to solve it yet.