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. Dismiss Notice

Bug with WebGL compressed builds

Discussion in 'WebGL' started by Steven_Damian, Mar 11, 2021.

  1. Steven_Damian

    Steven_Damian

    Joined:
    Mar 1, 2021
    Posts:
    65
    So here is the summary of my 2 weeks investigation with cloud engineers and others with serving compressed WebGL unity builds:
    1) In version 2019 the compressed builds(gzip&brotli) can be served without any problem (in computers).
    2) In version 2020 the compressed builds can not be served with error ( Uncaught ReferenceError:unityFramework is not defined at HTMLScriptElement.r.onload ).
    3) In version 2021 the compressed builds can not be served with error (Header with Content-Encoding: (gzip or br) is missing)

    Even after trying to tackle the errors with changes in the configuration files and adding .htaccess files, i haven't managed to solve them. Please feel free to say solutions/thoughts! Thank you.
    upload_2021-3-11_22-10-50.png

    22.png
     
  2. elZach

    elZach

    Joined:
    Apr 23, 2017
    Posts:
    48
    I noticed this in 2020 versions and stopped compressing webGL builds, as I figured the host (itch.io) would run a compression on the file.

    This error message reads like it's on the hosts end - but if you tried the same compression with 2019 and it worked than that's weird.
     
  3. Steven_Damian

    Steven_Damian

    Joined:
    Mar 1, 2021
    Posts:
    65
    Hello eIZach ! Exactly! So i use aws servers to host the builds. I've tried both apache/nginx without any luck. I am sure unity engineers are aware of this issue. It's indeed weird.
     
  4. Jimangel

    Jimangel

    Joined:
    Nov 29, 2015
    Posts:
    4
  5. Steven_Damian

    Steven_Damian

    Joined:
    Mar 1, 2021
    Posts:
    65
    Solved for 2020 and 2021 by allowing .htaccess files.
     
    corbinyo likes this.
  6. Bradley400

    Bradley400

    Joined:
    Nov 6, 2019
    Posts:
    2
    Can you offer more info about this solution? Do you allow .htaccess files on the server or in Unity settings?
     
    Bentoon likes this.
  7. corbinyo

    corbinyo

    Joined:
    Aug 23, 2017
    Posts:
    26
    @Steven_Damian Yes, can you please elaborate on what "allowing .htaccess files." means, thank you!
     
  8. Till_LeFx

    Till_LeFx

    Joined:
    Dec 1, 2016
    Posts:
    9
    Hey there. I discovered the error as well, with Unity 2020.3.2f1 (LTS).

    Of course, a workaround may be disabling compression, but unfortunately that inflates the build badly.

    For now, I found a solution here, which works for me with Brotli-Compression enabled.

    https://answers.unity.com/questions/1804378/webgl-builds-in-version-202021f1-are-not-working.html

    UPDATE:
    According to Unity's documentation "WebGL: Compressed builds and server configuration" it's a recommended solution to enable decompression fallback "...if you have less experience with server configuration, or if server configuration is unavailable to you...Note: Using this option results in a larger loader size and a less efficient loading scheme for the build files."

    https://docs.unity3d.com/2020.3/Documentation/Manual/webgl-deploying.html
     

    Attached Files:

    Last edited: Apr 7, 2021