Search Unity

Is WebGL caching broken?

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

  1. Dabeh

    Dabeh

    Joined:
    Oct 26, 2011
    Posts:
    1,614
    Hey,

    When I first load the app, on incognito, it works fine. Second load, however, I get this:

    PlatformGetStacktrace
    UnityLoader.js:4 Exception encountered in operation Resource<TextAsset>(exptablebaseconfig.txt):

    Nothing changes in the path, this is hard-coded in. Just running it twice breaks it. After getting rid of any cache etc, it works fine until it's restarted and then it's broken again. This happens for all assets that try to get grabbed.
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    In the group settings, there's an option for "use asset bundle cache". Try turning that off and let me know if that "fixes" the problem. I'm guessing something is going weird with caching in a browser.
     
  3. Dabeh

    Dabeh

    Joined:
    Oct 26, 2011
    Posts:
    1,614
    Yep, this was the fix I did when making this post(ofcourse, no more cache as a result) and the build started working fine afterwards. A bit unfortunate! Caching is important for WebGL ;)
     
    unity_bill likes this.
  4. BFS-Kyle

    BFS-Kyle

    Joined:
    Jun 12, 2013
    Posts:
    883
    Just wanted to check to see if there were any updates on this caching issue for WebGL builds? Disabling asset bundle cache fixed it for us too, but would be ideal to be able to keep caching enabled.
     
  5. LorenzoNuvoletta

    LorenzoNuvoletta

    Joined:
    Apr 28, 2014
    Posts:
    54
    Resuming an old one, was this ever fixed?
    UnityWebRequestAssetBundle.GetAssetBundle(url, version, 0); seems to ignore newer versions and always loads the old cache on WebGL.
     
  6. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
  7. LorenzoNuvoletta

    LorenzoNuvoletta

    Joined:
    Apr 28, 2014
    Posts:
    54
    Thanks, I am using 2022.1.7 and the WebGL cache is not great on Chrome. Is there a way to manually read the version number of the cached assetbundle and invalidate them? The class "Caching" doesn't work on WebGL.
     
  8. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    I'm not personally sure, the WebGL forum would be a better place to ask. I did find some manual docs though that would be a good start https://docs.unity3d.com/2022.2/Documentation/Manual/webgl-caching.html

    As you can imagine, this is a completely new cache system for WebGL. The "Caching" API is associated with the old system.