WebGL for Unity application in website

I am working on uploading my UNITY VR experience to my website.

I was able to build in WebGL format. The output gave me an Index.html, Build, and Template data folder

I was able to run it in Firefox.

The intro and main menu loaded properly. (I had some issues with the display, since I saw the default html was set to 960 x 540, and I created this in 1920 x 1080.)

Clicking “START” would load the game but this error came up. Googling it gave no results and I am not sure how to approach this issue.

The error said “See your browser JavaScript console for more info.”
What came up was

does [×] development build give any better errors?

I tried it.

Gave me the same error.

There’s a few other settings aside from Development Build checkbox worth noting:

1 Like

I followed the settings in the linked you shared. Just to confirm, this is the proper settings to export WebGL format? Or is it to allow us to debug and fix the Scene (and we ideally need to revert to the original settings, once we got everything fixed?)

When I did all of that, I was able to run the scene w/out the error! I guess it’s a step in the right direction. I also used the Javascript Console. I got some 99+ errors

7100791--846349--upload_2021-5-3_7-59-35.jpg
7100791--846352--upload_2021-5-3_7-59-58.png

Do you have a class called Raycast? Like if you type “Raycast” in the Project window search bar, does it list anything like that? If you do, open that, comment out all the code in CrosshairNormal function - then see if it runs without errors. You might have to comment out everything in Update too if anything subsequent depends on what’s being done in CrosshairNormal. If that’s what’s going on you could post the offending code here and me or someone else might see what’s wrong… otherwise, I’m at a loss. I haven’t seen that specific error before, this is just a guess.

1 Like

I have a Raycast script. All it does is put out a dot/crosshair in the middle of the screen. After some thought, it does seem obsolete in the current build and there would be no issues removing it. I’ll give it a shot and see if it works.

Curiously, the PC output of the same scene does not give this error. It was only when I built it using WebGL format that it came up. This is possible?

I never considered it as the PC App worked fine even with that.

7100881--846403--upload_2021-5-3_8-53-30.png

EDIT:
so I deleted it and it works now with no problems

strange that in the PC build that script was never an issue but it was in the WebGL version of the same scene.

I also have another project with the same crosshair script, and it works fine on WebGL. I am not sure why it was a problem here, but the issue is solved for now! thanks!

1 Like