I built a WebGL version of my game, and if i run the index.html file, it doesn't load

I opened index.html and it just showed the unity WebGL loading screen. Any help?

I use Microsoft edge

Inspect element console errors:
6450306--722376--upload_2020-10-23_11-42-52.png

The issue here is that you are opening the index.html file directly in the web browser, without using a web server. In order to work properly, WebGL builds need to be hosted on a web server.

Unity spins up such a web server when you use the Build and Run feature. That is the simplest way to run the built content.

If you have python installed, you can use “python -m http.server” command (Python 3), or “python -m SimpleHTTPServer” (Python 2) to spin a web server, or you can download a bit more advanced python web server from emscripten/emrun.py at main · emscripten-core/emscripten · GitHub .

With node.js there is also a way to spin an ad hoc web server: check out a guide at Ad Hoc Web Servers the Easy Way .

For more advanced server setups, check out Nginx, Apache or IIS.

Another way might be to use an existing online WebGL hosting service: Unity WebGL Publisher, Itch.io, Simmer.io or Facebook to host.

Other forum users have probably good setups that they run with, with varying degrees of difficulty to set up. Maybe someone can suggest what worked the easiest for them?

1 Like



why my build is different from other builds i see on internet and youtube tutorials

That is not a unity project file, that is the index.html that is produced from the project build and is expected. You should not be editing that file directly.