Issues with building WebGL

Hello!

I’m trying to build my game as a WebGl, but the “Build and Run” button is not clickable -

I tried to reinstall the “Share WebGL Game” from the package manager, but nothing happens.
What do I do? I really wanna share my first game with you!

Hi AvocaDoom,

The WebGL plugin seems not to be installed. Click on “Open Download Page” and install it. If that did not work, reinstall Unity and make sure you select the WebGL option during the installation routine.

Did this help?

Yes it did help, Thanks!

But now when I click “Build and Run” it shows these errors:


Should I just erase these scripts?

Thanks!

Those messages with the yellow icons are harmless warnings, probably caused by a bug in Unity. Double click on each message in your Console, and add = default; behind the respective variable declaration.

Regarding the red ones, try the following:

  1. Save your build on your harddrive but not inside your project folder, on your Desktop or in a cloud.
  2. Use English characters only for your file and folder names.
  3. Make sure that neither your firewall nor your antivirus program block Unity.

Ok, So i fixed the yellow errors, checked my firewall and antivirus (both not blocking unity) saved it in another folder and ran it again. the same red errors appears

My main user on my computer is in Hebrew, and that’s where Unity’s installed. Do you think that’s what’s causing the problem?

Good question but you are not the only student with a Hebrew system language, and other students with non-Latin glpyhs managed to build their games, too.

What is the path to your project? And what is the path where you tried to save the build? If your project folder is in your user folder, and if you used Hebrew characters for your user name, that might be causing the problem.

Maybe you could join our official Discord chat and ask if somebody with a Hebrew system language managed to build their game or ran into issues which they were able to solve.

Ok, So I changed the name of the User to English, and the build was finished, but I have a different problem - As it finished the build it opened a local host browser window, which loads the game with the unity logo, but the game doesn’t load, even after a while. It’s like an Empty file, even though it works perfectly in unity. I even tried to upload it to Unity WebGl, but it’s all the same.

What should I do?

Sorry about all this questions, I’m a bit frustrated with this. Thank you for your help.

Does your browser say that WebGL cannot be played? I had the same problem recently.

If not, press F12 in your browser to open its console. Are there any error messages?

Only these two

Thank you. I did some reasearch on the error, and it seems that deleting the Library might help.

Close Unity and VS. Delete the Library folder and restart Unity. Then build your game again.

Do you mean deleting the whole project folder and open a new one?

Not the project folder. Just the Library folder inside your project folder. If you are in doubt, make a backup of your project by duplicating your entire project folder.

Well, actually, it is a good idea to make a backup anyway to be on the safe side. Make a backup, save it somewhere else, then delete the Library folder inside your original folder. Launch Unity. This might take a while because Unity regenerates the Library folder. Open your scene. Test your game. If everything is working, build your game again.

I did all of that, but still the localhost version just shows a black screen. and I tried it on different browsers.

Do you still have the same error message in your browser console?

Yeah, Same 2 errors

Please follow Rob’s instruction on debugging WebGL projects. Maybe other error messages will pop up in your browser console.

If you cannot find anything, please upload your game to sharemygame.com and share a link here. Maybe the problem is your browser, and your game actually works on other devices.

I figured out what the problem was!

Once I uninstalled my previous Unity version, and reinstalled the latest WebGl release, I’ve manged to upload it properly!

Thank you so much for your help! Here is my game :slight_smile:

1 Like

Good job! I’m glad it’s finally working! :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms