I’ve been creating webGL builds for a long time now, and have had no issues with it. However, recently, the build would only output 2 files in the build folder instead of 4 like it is supposed to. The generated index.html file tries to reference the missing files, and nothing works! I cannot build my project. I tried updating macOS, updating Unity to the newest LTS version, and many many more things in build settings but it just won’t work. it only puts two files in the build folder no matter what I do. This leads me to believe that it has something to do with the project files, but I have no idea what that could be. Does anyone have a solution for this? I wasn’t able to find anyone else who had this problem, despite hours of research.
That is a bit strange. Maybe something wrong with a build settings??
I have been typically using webGL for game jams on itch.io so I know alittle bit.
Have you tried:
- Creating a new project and making a webGL build? (This will help see if its your project or Unity itself)
- Building to a different folder
- Checking your build settings (File → Build Settings; making sure that WebGL is selected)
- Check your Project Settings (Edit → Project Settings → Player → select WebGL tab (has ‘5’ in the icon/tab). Specifically ‘Other Settings’ and ‘Publishing Settings’.
See attached screenshots for what I’m currently using!
So I found the issue. The last change that I made before the build stopped working was that I accidentally added two functions into a single .jslib file, which broke everything and caused a ton of errors. In the console I saw there were references to javascript errors, so I fixed that issue by putting each javascript function into a separate jslib matching the name of the function as you are supposed to. Pretty easy fix, but it was a nightmare to find.