WebGL build hosted on github - no player

Hi, i’m trying to create a little website for a school project.
I have used a service of github (username.github.io) to host a website for free.
I have builded a scene with webgl option in website folder (repo), then i have commit/push-ed to the repo.

The page is empty, there is only the unity’s logo and “unity WebGL” (basic template) without the player.

“On some servers you need to explicitly make .unityweb files accessible, because the server needs to provide these files to clients.”
As I understood i have to enable something to make .unityweb files accessible, right?
What am i missing?

"Moving build output files
To change the location of your Build folder, change the URL of the JSON file (the second argument of the UnityLoader.instantiate) in the index.html file."
I don’t get this part, this means the location of the build folder out of the project folder?
Or move build from the original build folder?

I’m not sure where things are going wrong for you specifically. I’ve used this guide here and had fantastic luck with it though.

2 Likes

Thank you very much, solved <3

I placed everything in root, and it was super wrong. Thanks again :'>>

The approach described on Medium’s been working for me and suddenly stopped recently with the following error:

Uncaught ReferenceError: UnityModule is not defined
at UnityLoader.loadCode.Module (UnityLoader.js:4)
at HTMLScriptElement.i.onload (UnityLoader.js:4)

It seems that this has to do with the additional headers necessary to “explain to the server” what type of MIME encoding *.unityweb files are. It seems that Unity have improved this in 2020.1 ( Changes to the WebGL loader and templates introduced in Unity 2020.1 ):

  • Unity 2020.1 supports server-friendly naming schemes for the build files.

However, I can’t easily upgrade now. I’m using simmer.io for now.