I am building my first WebGL test from Unity, and so far I’d call it “epic fail”, undoubtedly due to my own pilot error.
I’ve got a relatively simple, low poly, test scene that builds and runs on Windows and Mac. When I build this thing for WebGL, I run into the following problems:
I can’t play it locally at all, because Chrome won’t load WebGL content from a local file. (I assume this is a security issue? Is there a way to override that?)
When I upload the app to my Apache web server, the Unity logo displays in the browser, but the app fails with “Out of Memory” errors. I’ve tried memory settings from 256 to 2032 (the largest that Unity’s player settings page will accept) and it’s a no-go.
The memory error replicates in either Firefox or Chrome, latest versions of each.
I’m guessing I’m doing something wrong here, but I’m not seeing any other settings that are relevant. Any ideas? Thanks.
Update: I have successfully built and run a variant of my scene that is just a little simpler. Apparently, what you can run in WebGL is just not very complex. Everything seems to work okay, and it looks as if my main scene is just ever-so-slightly too big. It’s strange to have that happen when I don’t have any foliage or high-poly models involved, but…there it is.
And the lesson I have learned today: When troubleshooting Unity on Chrome, do not assume that Chrome documentation will be the best path to the answer. Good on you guys (Unity) for having that in the Unity docs.
Now I need to get that mesh decimated down to a reasonable poly count. I think part of the problem may be doubled vertices. I didn’t create it, but I’m going to snarf it into Blender and have a look at its topology. I have SimpleLOD from the Asset Store, so if all else fails I’ll stuff it into there and see what I get. (Blender’s decimation tools aren’t bad, but it’s a mathematically complex problem-domain, and the quality of results varies a lot depending on the input mesh.)
@Schubkraft and @Marco-Trivellato , I wanted to thank both of you for your help. After some further work, my project is 100% working in WebGL, Linux, Mac, and Windows.
I found that the troublesome mesh had some peculiar geometry that kept it from decimating well, even though I tried both SimpleLOD (Asset Store) and Blender methods. That specific mesh wasn’t critical to my project, so I simply removed it and used a new one that I built from scratch with clean topology.
This issue is now solved for me. Thanks very much!