Yeah with the changes they made the build output files are a bit different.
Check this one for the web.config
If you’re using hash as files name you gotta disable it because it is broken right now. The files lose part of their extension which causes issues with loading up things.
Thank you so much - I will try that and see if I get it working.
Brilliant, works now, loads up really quick now. Thanks again
DrViJ
August 16, 2020, 5:48pm
44
1 Like
Is there any indication as to when this will be fixed?
We want to upgrade our project from 2019.4 to 2020.1, but this bug is blocking us.
efge
August 26, 2020, 7:50am
46
It works now in Chrome and Firefox with the following settings:
This new approach completely breaks on iOS for iPad (which previously worked on 2019.x). So it’s great for other platforms, but unusable right now if targeting mobile. See regression here: Unity Issue Tracker - [WebGL] [iOS 13] Application on browser crashes when trying to minimize the browser 'Out of bounds Trunc operation'
1 Like
ina
September 8, 2020, 8:05pm
48
that .htaccess leads to new issues…
2809.loader.js:1 Uncaught TypeError: Cannot read property ‘1’ of null
at 2809.loader.js:1
at createUnityInstance (2809.loader.js:1)
at HTMLScriptElement.script.onload ((index):56)
(anonymous) @ 2809.loader.js:1
createUnityInstance @ 2809.loader.js:1
script.onload @ (index):56
load (async)
(anonymous) @ (index):55
cs.min.js:5 Uncaught onMessage is not defined
ina
September 8, 2020, 8:12pm
49
these appear to be the default settings anyway in 2020.1.41
Not sure what changes are also required on a server, but currently we can’t release WebGL builds with Unity 2020.1. However it works out of the box using Unity 2019.4.
Console errors in Unity 2020 range from “invalid character” to “unityframework not found” or similar. Tried all Player Settings combinations with no avail and had to revert to 2019 to make a build.
3 Likes
there is an issue with unitywebgl.loader.js and MacOS BigSur. the regex for parsing the version of MacOS errors, and the loading never finishes. I see this with Safari shipping with BigSur, didn’t test Chrome or Firefox
1 Like
alexsuvorov:
Hello, Johannski.
For Apache you can use the following server configuration (you can remove the parts which don’t apply to your build settings):
# This configuration file should be uploaded to the server as "<Game Folder>/Build/.htaccess"
# This configuration has been tested with Unity 2020.1 builds, hosted on Apache/2.4
# NOTE: "mod_mime" Apache module must be enabled for this configuration to work.
<IfModule mod_mime.c>
# The following lines are required for builds without decompression fallback, compressed with gzip
RemoveType .gz
AddEncoding gzip .gz
AddType application/octet-stream .data.gz
AddType application/wasm .wasm.gz
AddType application/javascript .js.gz
AddType application/octet-stream .symbols.json.gz
# The following lines are required for builds without decompression fallback, compressed with brotli
RemoveType .br
RemoveLanguage .br
AddEncoding br .br
AddType application/octet-stream .data.br
AddType application/wasm .wasm.br
AddType application/javascript .js.br
AddType application/octet-stream .symbols.json.br
# The following line improves loading performance for uncompressed builds
AddType application/wasm .wasm
# Uncomment the following line to improve loading performance for gzip-compressed builds with decompression fallback
# AddEncoding gzip .unityweb
# Uncomment the following line to improve loading performance for brotli-compressed builds with decompression fallback
# AddEncoding br .unityweb
</IfModule>
Can you share for nginx?, tried the following :
location / {
root html;
autoindex on;
autoindex_localtime on;
index index.html index.htm;
location ~* \.(loader.js)$ {
add_header Content-Type application/javascript;
}
location ~* \.(wasm)$ {
add_header Content-Type application/wasm;
}
location ~* \.(data.gz|symbols.json.gz)$ {
add_header Content-Encoding gzip;
add_header Content-Type application/octet-stream;
}
location ~* \.(wasm.gz)$ {
add_header Content-Encoding gzip;
add_header Content-Type application/wasm;
}
location ~* \.(framework.js.gz|js.gz)$ {
add_header Content-Encoding gzip;
add_header Content-Type application/octet-stream;
}
}
But getting the following from firefox :
The script from “http://localhost/test/Build/WebGL.framework.js.gz” was loaded even though its MIME type (“application/octet-stream”) is not a valid JavaScript MIME type.
wasm streaming compile failed: TypeError: Response has unsupported MIME type
falling back to ArrayBuffer instantiation
ina
September 17, 2020, 6:28pm
53
alexsuvorov:
Hello, Johannski.
For Apache you can use the following server configuration (you can remove the parts which don’t apply to your build settings):
# This configuration file should be uploaded to the server as "<Game Folder>/Build/.htaccess"
# This configuration has been tested with Unity 2020.1 builds, hosted on Apache/2.4
# NOTE: "mod_mime" Apache module must be enabled for this configuration to work.
<IfModule mod_mime.c>
# The following lines are required for builds without decompression fallback, compressed with gzip
RemoveType .gz
AddEncoding gzip .gz
AddType application/octet-stream .data.gz
AddType application/wasm .wasm.gz
AddType application/javascript .js.gz
AddType application/octet-stream .symbols.json.gz
# The following lines are required for builds without decompression fallback, compressed with brotli
RemoveType .br
RemoveLanguage .br
AddEncoding br .br
AddType application/octet-stream .data.br
AddType application/wasm .wasm.br
AddType application/javascript .js.br
AddType application/octet-stream .symbols.json.br
# The following line improves loading performance for uncompressed builds
AddType application/wasm .wasm
# Uncomment the following line to improve loading performance for gzip-compressed builds with decompression fallback
# AddEncoding gzip .unityweb
# Uncomment the following line to improve loading performance for brotli-compressed builds with decompression fallback
# AddEncoding br .unityweb
</IfModule>
this worked
using brotli compression / chrome
Apache
Zephus
September 18, 2020, 12:35am
54
@alexsuvorov I would really appreciate any kind of update on this.
As of right now the default settings don’t work for both local builds and most servers. You can’t just build your games and upload them to itch.io or any other website anymore. You have to mess with the compression settings, which seems like a really bad idea. Not to mention that it’s really hard to find out what’s even wrong.
The default settings for builds should just work, and as far as I see it, these settings can’t stay like this moving forward.
4 Likes
ina
September 18, 2020, 6:04am
55
Zephus:
@alexsuvorov I would really appreciate any kind of update on this.
As of right now the default settings don’t work for both local builds and most servers. You can’t just build your games and upload them to itch.io or any other website anymore. You have to mess with the compression settings, which seems like a really bad idea. Not to mention that it’s really hard to find out what’s even wrong.
The default settings for builds should just work, and as far as I see it, these settings can’t stay like this moving forward.
Should probably have a checkbox that indicates whether one is using Apache or IIS server to automate the .htaccess generation
2 Likes
alexsuvorov:
Thank you very much for pointing this out, Johannski. Using “Name Files as Hashes” does indeed strip away the “wasm” suffix which prevents the response header from being added correctly. For the same reason the “Name Files as Hashes” might also currently break multi-threaded builds. We are working on a resolution.
Is there any update on this issue? It has been months and even in Unity 2020.1.6 this problem still persists.
Is there an issue tracker for this?
1 Like
Found out working nginx rules for Unity WebGL 2020.1++
location / {
root html;
autoindex on;
autoindex_localtime on;
index index.html index.htm;
location ~* ^.*\.(js)$ {
types {}
default_type application/javascript;
}
location ~* ^.*\.(wasm)$ {
types {}
default_type application/wasm;
}
location ~* ^.*\.(wasm.gz)$ {
gunzip on;
gzip off;
types {}
default_type application/wasm;
add_header Content-Encoding gzip;
}
location ~* ^.*\.(framework.js.gz|js.gz)$ {
gunzip on;
gzip off;
types {}
default_type application/javascript;
add_header Content-Encoding gzip;
}
location ~* ^.*\.(data.gz|symbols.json.gz)$ {
gunzip on;
gzip off;
types {}
default_type application/octet-stream;
add_header Content-Encoding gzip;
}
}
Clear the browser cache and reload the page.
3 Likes
xcsasdc
October 10, 2020, 7:49am
58
Why is. Wasm loaded twice?
1 Like
Hi all, I want to upgrade our project from 2019.4 to 2020 to improve the webgl loading&startup time.
Are there any noticeable improvements using 2020 instead of 2019.4?
1 Like
I’d also like to vote on this
1 Like