I’m creating a fresh URP project using Unity 2020.1.1f1. Then I build a WebGL project and zip the output files so that .zip contains index.html and TemplateData and the Build folders. I have tried uploading that zip to itch.io, and gamejolt.com but it doesn’t work in either. It simply gets stuck right at the beginning like this:
I have tried building with following settings with no luck:
Compression Enabled
Compression Disabled
Compression Enabled + Decompression Fallback
Development Build
but none of those settings seem to make any difference. Project itself works, because if I use Build & Run and let Unity create fileserver to serve the game it works just fine. So it has to be something related to building the WebGL project. There are also no errors in the browser console. Same issue happens in all mainstream browsers.
Thanks. Looking at the content that is server by Itch.io via Chrome Network Devtools, it shows the following that the files Petridish.data.unityweb, Petridish.framework.js.unityweb and Petridish.wasm.unityweb are all properly served as gzip compressed, as is shown by the presence of the Content-Encoding: gzip header.
They are doing the Right Thing when it comes to web hosting, and they employ a server-side compression cache to compress content on-demand when browsers visit them. When a server-side on-demand compression scheme is being used, developers should disable pre-compression in Unity build settings. So when uploading content to Itch.io, one should have Compression Format: Disabled and Decompression Fallback: Disabled.
The other alternative is when a web server does not have an on-demand server-side compression engine in place. In that case, users should pre-compress the content on disk when doing the Unity build by enabling Compression Format: gzip, and then configure the server HTTP Response Header to advertise Content-Encoding: gzip for those files.
I was curious why it failed originally, though, so I reproduced the issue today by creating a new clean 2D project in 2020.1.8f, building and pushing with default settings: brotli compression and no compression fallback.
It looks like itch.io does not set “Content-Encoding: br”, though, and since there is no compression fallback, it fails. I guess that particular issue should be reported as a bug to itch.io, then?
Anyways, I also tried enabling decompression fallback. This time however, I see no errors in the console, just a warning that the fallback is being used, but then it’s stuck with no errors:
This, to me, looks like a bug in the unity compression fallback, though I’m not super-familiar with all the http response headers. WebGL.framework.js.unityweb has content-type: application/octet-stream for instance, which I don’t really know whether is wrong or not… maybe it should say application/javascript?
Anyways, you can try both projects if you want, password is “bug”
That is correct. This is an Itch.io bug/missing feature - according to that result, they do not currently support on-disk pre-compressed Brotli content. Would be sweet if they added support for that!
Hmm, what should this build show? When I visit it, I see a blue screen, no errors. Looking at the performance profile (https://share.firefox.dev/36LM6vA), I see that the Unity engine main loop is ticking, so the engine should be up and running, but there doesn’t seem to be any content loaded. Is there supposed to be something in the scene?
Looking at the Network tab, when I was testing on Edge for the first run, I did see really slow download speed of the .wasm.br file, it took 39 seconds for Itch.io to serve the 622 kB WebGL.wasm.unityweb file, resulting in avg ~15.9kB/sec download speed. That seems like the core issue here.
If you open the Network tab before visiting the page, it will show all the downloads that are active, and that are still processing. That will help debug whether a startup stall is due to slow download speeds, or due to Unity engine stalling. (You can do a 5-10 sec Performance profile snapshot when things have stalled to double-check if it’s stalling in executing Unity code. In this case when I did that while the .wasm network transfer was still going, Performance profiler will show an empty list, as no Unity code is yet executing)
I did some further testing, and found some really weird connections:
It only happens in Chrome and Chromium, not in Firefox, Edge, Epiphany
It happens in Chrome/Chromium on all my devices (2x Windows 10, Linux, Android)
Was an issue in Chromium 81 as well
I tried disabling wi-fi on my phone to see if that helped, but it didn’t
The issue happens in both regular mode and incognito
BUT! If I log out of chrome it disappears, so it’s somehow tied to my user, or perhaps just being logged in (I only have one user) and the weird thing is that being logged in seems to affect incognito mode as well.
I tried disabling all browser extensions, but it still didn’t work
So yeah, it seems somehow tied to my Chrome user.
@jukka_j were you logged in when testing on Chrome?
Would be interesting if @BuoyantOtter could do some similar testing.
As for debugging the issue itself. Here’s a screenshot of the profiler.
So at least it looks like it gets done decompressing then some stuff seems to be happening, and then sporadic "Task"s every other second (it just continues like that to the right). Sometimes I see GC and some event handling. Not really sure how to interpret that, though.
If you close the “Headers | Preview | Response | Timing” part I believe it should show the state of all the files.
I was logged in to my Google account.
I wonder if clearing the browser cache would have an effect.
The decompress block occurs immediately when the files are received. The Unity engine does not seem to have run there yet, so it looks like it’s still waiting for a file to come in.
Quite mysterious… to double check, this elusive stuck-during-load only occurs when you enable precompressed files with decompression fallback turned on?
Hello, I’m running on a similar problem, I’ve uploaded my game to Game Jolt and it’s not playing, but it’s available on Unity Play and working pretty fine: SkyKart - Unity Play what am I doing wrong?