I started developing a game on a Unity LTS version 2020-ish and later decided to port it over to WebGL but that was such a drama, in the end I managed to make it playable by sacrificing the game’s audio. But man the things I had to do to get to that point. What I dislike about Unity is that there are very weird bugs that popup upon a new version release whose code probably wasn’t even touched for that new release to begin with.
Before the drama started I ofcourse had to fix mandatory things like capping the fps amount, fixing all the memory issues, changing the websocket solution so it doesnt use native sockets, eliminating any dotnet library usage cause the browser doesn’t support it (I was using an old version of newtonsoft’s JSON solution and now I use JSON.NET the newer version), letting exceptions go through so the browser doesn’t crash for testing purposes. Those are understandable issues, but…
First I had an issue where the game’s audio wasn’t working (Unity Issue Tracker - [WebGL] Audio is not played when in built Player) apparently I could fix that by updating my version to 2021.1.x (which is a beta version). Yes, that fixed the audio, but not entirely, for some reason the audio plays only a couple times until it just gives up and it also just entirely stops working if you switch tabs.
Now that wasn’t a big deal, but the next issue that popped up blew my mind. For some reason that exact version’s UnityWebRequest.downloadhandler.data always returned null. Literally only that property of downloadhandler suddenly always returned null, I double checked, triple checked, debugged everything and I simply could not find the culprit thinking I made a mistake, turns out it’s a known unity issue Unity Issue Tracker - UnityWebRequest downloadHandler.data is null after downloading a texture using UnityWebRequestTexture.GetTexture() Note how it says fixed in ‘‘2022’’. Now this was a huge gamebreaking issue for me because my 2d game downloads a lot of textures from the internet and it needs to cache it for future use, I make use of the bytearray it returns from the downloaded texture.
So anyway I downgrade my version to a version that doesn’t have this issue, I decided to stick with an LTS version because I thought that would be a reliable version, nope, I downgraded and suddenly this issue arised = Unity Issue Tracker - [WebGL] Mouse events are not called on builds when the scene does not have Event System object
Bonus: I have to set exceptions to None so my webgl build will run faster and take up less space, turns out you can’t do that with a couple unity versions, which is another bug = How do I DISABLE_EXCEPTION_CATCHING = 1 for webgl?
After this, the only unity version I have found that doesn’t have gamebreaking issues is the one that has no webgl audio working, so compromises had to be made and I stuck with version 2020.2.0f1
Now the biggest issue that is left - and it seems Unity doesn’t want to fix - = Mobile touch input in input fields for webgl Unity Issue Tracker - Mobile virtual keyboard does not pop up when Input field is tapped inside mobile device browser
Question #1. Will Unity make Webgl work with mobile’s input field? If yes, when?
Question #2. Is there a unity version that eliminates all the bugs I described, including the webgl audio?
At this point I should just rewrite the front end of my game in React, which will also use less CPU and Memory. Is there a secret plan of ditching WebGL and Unity doesn’t want to tell us and that is the reason why their support for WebGL is so lacking? Porting a Unity game made to browser is only possible through WebGL as far as I know without rewriting the entire game, it enables a developer to target a bigger audience. Especially for iOS/mac users because I only have PC and Android builds and no Mac builds.

