Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

WebGL crashes for different users, how to analyze?

Discussion in 'WebGL' started by OneManBandGames, Nov 14, 2015.

  1. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    I just published a small game on Newgrounds, Kongregate, Gamejolt using the Unity WebGL export. The game runs fine for me in Google Chrome and Mozilla Firefox and even in good old Internet Explorer (without sound though.) Some players are now reporting that the game crashes for them on load or during the game. Unfortunately they mostly report it back with "Doesn't work" and a bad rating so I have little information on system configuration or what is happening during the crash. What I know is that:

    • Crashes happen in Firefox as well as in Chrome
    • Mostly during the loading process before the game starts
    I already tried the following to fix the problems:
    • Doubling the WebGL meomry size from 256 MB to 512 MB
    • Removing Code Stripping form the player settings
    • Disable Exceptions in the player settings
    These were the measures I was able to collect from other general "WebGL crashes" threads. Do you know of any other settings that are prone to create crashes that I could try? Could you propose a methodology on how to analyze the problem without being able to reproduce the crash by myself? I'm eager to look into this and to fix this problem, but without reproducing the issue it is just wild guesses at the moment.

    The game in question can be found here on Newgrounds: http://www.newgrounds.com/portal/view/666024

    If you experience a crash it would be great if you could post your browser, amount of Ram on your computer, amount of ram on the browser process in the task manager (if possible) and an error message if you got any.
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Do you know how much memory does the browser use when running your game ? (by looking at Task Manager)
    Any chance you can gather information regarding whether they are running a 32-bit browser ?

    Well, actually, assuming it's an out-of-memory problem, you need to find out whether it's the Browser or Unity that is running out of memory, because the solution is quite different. Until then, I would recommend the following:
    • set WebGL Memory size to 256 (or even lower)
    • enable Strip Engine Code.
    • disable Exceptions in the player settings
     
  3. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    Thanks for the quick reply!

    I have now published the game using the following settings:
    • set WebGL Memory size 128 MB
    • Strip Engine Code enabled
    • Exceptions in the player settings disabled
    Both Firefox and Chrome use about 600 MB of memory when running the game on my system. I will ask an user who couldn't play the game yet to try it again with these settings & I'll ask him whether it is a 32-bit browser.
     
  4. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    Got a reply, the game crashes and the user has a 64 bit browser. Game also still seems to be crashing for other users as well. :-/
     
  5. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I just launched it and got this out-of-memory error:

    "The browser could not allocate enough memory for the WebGL content. If you are the developer of this content, try allocating less memory to your WebGL build in the WebGL player settings."

    what's the size of your uncompressed data (.data) and code (.js) ? (look at the Release folder)
     
  6. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    Thanks again for looking into this!

    The .data file is 55 Megabytes and all .js-files together are 23 Megabytes.
     
  7. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I would not expect the browser to fail allocating 55mb of data, however, it's possible this is a fragmentation problem. Any chance you can:
    - reduce the data size by optimizing assets or moving some them to an asset bundle to download later
    - reduce your Unity Heap size (WebGL Memory Size) even further ?
     
  8. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    I already tried to optimize assets before launch, since the game is also available on Android and I wanted the package to be as small as possible to save storage place on the user's devices. I have no experience with asset bundles yet, I will look into it whether I can work with them.
    I already tried to reduce the Unity Heap Size to 64 MB, but this gave me an error Message during loading, if I remember correctly something along the lines that I should increase the memory amount in the player settings.
     
  9. support

    support

    Joined:
    Oct 24, 2013
    Posts:
    19
    Nice game! However, it is too long to wait when it is loaded for the first time. Looks like you do not use the compression on the server side or the server is too slow. Hopefully, this problem will be solved with Unity 5.3.x .
    Back to your question: We figured out that it is very helpful to gather the browser console log from the real players and send it to our server for analyzing the reasons why and when the game crashes.