Here's why the marked solution is a tradeoff, not a solution. Making something work isn't necessarily solving the problem.
If you disable compression in WebGL, your build will have a significantly larger size, causing prolonged load time and a larger download size. So, by 'hacking' it, you introduce two new problems to make some error messages you don't understand disappear.
saved 40 MB using compression
On the following page, you can find the necessary configuration to allow content decoding from your server (depending on what you use):
https://docs.unity3d.com/Manual/webgl-server-configuration-code-samples.html
For example, I use Apache, and by simply adding a .htaccess
to my build's root with the following content, I was able to use, in my case, gzip
compression, and it loaded very quickly compared to uncompressed format (wasm
).
<IfModule mod_mime.c>
RemoveType .gz
AddEncoding gzip .gz
AddType application/gzip .data.gz
AddType application/wasm .wasm.gz
AddType application/javascript .js.gz
AddType application/octet-stream .symbols.json.gz
AddType application/wasm .wasm # need this line to serve decompressed wasm file
</IfModule>
That finishes the decompression server configuration and allows your server to load the gzip content.
Try gitattributes for Github pages
Note that this might also be a workaround, since Unity doesn't account for gh-pages server.
Namely, the thing you could try with GitHub pages would be to use the .gitattributes
file at the root of your repository, with the following configuration
*.data.gz binary
*.wasm.gz binary
*.js.gz binary
*.symbols.json.gz binary
*.wasm binary
disclaimer: not sure if it will work