So I have this pretty major problem with hosting my game. Please know that I am an absolute beginner at using unity and just made my first "larger" game. I build my game and everything works fine, I get my files and I get my index.html. When I open it, it brings me to the page as intended and I can see the unity logo with the loading bar beneath it. The problem is the loading bar does not go up at all. It is simply stuck at the beginning. I have tried it in all browsers I have (Chrome, Firefox, Microsoft Edge and even Internet Explorer). It loads nearly all the way on Edge and Explorer is simply super cringe. However, I have no idea what this problem could be. It is not uploaded to a host and is only This is very important to me because it is related to my diploma project, which is a necessity to graduate high school where I live. Here are some screenshots: Chrome Edge Firefox Explorer (this one is just cringe) Edit: Pictures didn't work Edit 2: Thank you polemical for telling me to check the error messages, they are as following: I have no idea what any of this means but something is clearly wrong here. The blacked out parts contain my name Solution: Host the webpage with a local server, I used Servez. Also disable compression when building the project. Thank you to polemical and See_Sharp for helping me figure this out!
Hit F12 or otherwise open the Javascript/Developer Console - hit F5/refresh the page and look at the errors you have. If you can't fix them on your own at least you'll have more info to post.
I updated my post with the error messages but I understand none of them. I understand that there is a syntax error in the framework and some error with a loader but further than that I do not know.
From what I gather it's problematic to run locally without a local web server (I use Wampserver). You can get instructions with a search for "unity local file vs http webgl" Edit: if you do set one up vs. getting a specific browser working without it, you would then build to a folder like C:\wamp64\www\myproject\ - and then load it in the browser using http://localhost/myproject
So I did find a local server called Servez which seems to do the trick, There are still problems though. It seems to have solved the loader problems but there is still something wrong with a framework: Do you understand any of this? Because I sure don't! Also thank you very much for helping me so far! Edit: it now the loading bar loads almost all the way but stops a short bit from the end
I'm not sure what could cause that - hopefully someone else can jump in with an answer. While you're waiting, if you haven't checked this out, it's good to be familiar with: https://docs.unity3d.com/Manual/webgl-building.html
Hi, take a look at this thread, hope it helps https://forum.unity.com/threads/sol...ntaxerror-invalid-or-unexpected-token.872581/
WebGL does require some web knowledge to get it ticking. First, disable the compression in the playersettings. Enabling compression requires your webserver to serve your content correctly, since you do not have a webserver running, it doesn't even serve it. Second: Try to do a build and run (Ctrl + B). This will host a mini webserver and open up your index.html page automatically after the build completed. This should work out of the box without compression enabled. Unity WebGL needs to be hosted on a webserver. If you want to use compression, and I strongly advise you to do so, you have to configure your web server to host those files with the correct content-type as described here.
Hi! I'm having the same issue (meaning that there are errors when trying to run the game through WebGL build). Just to be sure that I understood the comments above correctly: when I disable the compression I also have to have a webserver for the game to run? Sorry for the noob question, still a beginner in coding and Unity.
I got this error again again and again dont know to deal with it, I am new to unity and practicing through unity learn platform but it get error error and error
use essa ferramenta para rodar o webgl localmente: https://s3.amazonaws.com/SimDemo/tools/SimLab_WebGL_Starter_v1.0.exe em breve farei um vídeo explicando isso, se possível-se no meu canal: https://www. youtube.com/channel/UCDOeEtDRjMdKJp5HIkm-eUw
Install python server in your local machine. Build your project from unity. Navigate to your build folder open cmd in current directory. Run command for windows user : > python -m http.server and > python3 -m http.server on Mac. It shows the port number. Open any browser in your system and type localhost: portNumber in my case it is localhost:8000 hit enter your game will run locally.
@Talha_140 does it work when you do build and run from inside unity? or always give the above message? or is it only giving it from your webserver, or or when run on specific devices or what?