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

Webgl - Random Crash during asset bundle downloading

Discussion in 'Web' started by aresgameshk, Dec 10, 2018.

  1. aresgameshk

    aresgameshk

    Joined:
    May 19, 2014
    Posts:
    32
    My game will crash while downloading asset bundles. We have a total amount of around 12 bundles, each has around 10-30Mb. Most of the users are able to download everything without a problem, but some user will crash while downloading the 7th-9th bundles, and the game will crash... Probably a memory issue? anyone know how to fix it? slicing the asset bundle even smaller?
     
  2. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    167
    You should provide strackTrace and final error.. we don't know is it OOM or not.
    If it's OOM then it's low memory in webgl build settings, for example 128MB and your AssetBundles size is greater than 128MB in total include your game runtime size.. then you can increase this 128MB (my examle, you can already have 256 MB and can try to increase). But if you set it very high (for example 512MB) then more users will get crash OOM in the prog start (another OOM case) due to browser memory fragmentation or memory limits on end-user browser.

    Also you can load ABs step-by-step with unloading previous, to decrease used memory.

    Also native ABs (as I know, tested in past in unity 5) is caches in memory after downloading, as unity's implementation store it in memory and NOT release this memory.. also it's stored in IndexedDB and reloaded from it after webgl start, i.e. it's in memory all-the-time! Special plugins for example this https://github.com/kongregate/Unity...ster/Assets/Plugins/WebGLCachedXMLHttpRequest is invented to avoid this.

    You can dig into memory layout https://blogs.unity3d.com/ru/2016/12/05/unity-webgl-memory-the-unity-heap/
    and into profiler - attach it (when build with option autoconnect profiler) and see memory used

    "slicing the asset bundle even smaller?" is not the case, because ABs will be downloaded and stored in memory and not released from memory - there are no difference to have 10+10+10+10 or 20+20 in total 40mb.
     
    Last edited: Dec 23, 2018