Reputation: 93
When I try to run my Unity project with WebGL building on localserver IIS or Tomcat, it gets stuck like this:
(the loading page is open successfully, but progress bar does not move)
I have already added the config file for IIS, and there is no error when the browser (both Firefox and Chrome) open the index. It seems that the loading pages opened in browser are the same with and without localhost web server.
In some situations the loading can succeed:
1.directly choose "Build and Run" in Unity Engine, and the web page can successfully run the game.
2.once the building process failed with an error(a file cannot be deleted). I tried the semi-finished building project in the Temp folder of project root, and it successfully worked. But later I copied that folder to another place, it stuck on loading page again.
the Unity version is 2020.
How can I solve the problem?
Upvotes: 8
Views: 16705
Reputation: 21
If Descompression Fallback or Compression format: disable is not working for you... try this:
What I did was downgrade my Unity version to 2019.4.9f1 and that've worked for me, no more build errors, no more endless loading screen... hope this can help anyone.
Seems like Unity2020 has an issue with WebGL compilations.
Upvotes: 0
Reputation: 188
While one way of solving it remains to turn off compression (but not very satisfactory, nor efficient) another one is just to check the DECOMPRESSION FALLBACK at the bottom of the Publishing Settings in the Player settings:
File > Build Settings > Player > Publishing Settings > Decompression Fallback
Voila.
Upvotes: 2
Reputation: 189
For anyone trying this, disabling compression in player settings worked for me (Unity 2020.1.2f1) Go to Build settintgs -> Player Settings -> Publish settings -> Compression format: disable
Upvotes: 16
Reputation: 93
I've found a solution myself. I chose "Development Build" while building the project, and it runs successfully now.
I tried this because when I used chrome console to run and check the js code, two errors jumped out, and I found the url .js file was messy code. So I guess maybe the code was wrongly compressed in release mode.
Upvotes: 0