The Day Unity Broke The Internet


Okay, hyperbole aside, Unity mistakenly hardcoded checking the browser's userAgent for MacOS 10 in their "WebGL" game support. MacOS 11 shipped a few months ago and Chrome/Edge started reporting MacOS 11 when Chrome/Edge is run on MacOS 11.

Result: Nearly all existing Unity games on,,, as well as Unity based visualizations on science sites, corporate training sites etc, stopped working for anyone running MacOS 11 using Chrome/Edge (and probably Brave, Vivaldi, etc...?)

It's an interesting issue

Unity shouldn't have hard coded checking for MacOS 10 and failing if it didn't exist

That's just a bug and they have since fixed it. Though ... DOH! Did it really take much thought not to write code that failed if not "10"?

Unfortunately there are many years of games and visualizations out there. It's unlikely most of those games will get updated. Further, even though Unity's main fix is to fix the bug in Unity itself, to apply it you'd have to re-compile your game in a newer version of Unity. Not only is that time consuming but it's no improbable your old project is not compatible with current versions of Unity and will require a bunch of work refactoring the code.

Fortunately you can just replace the file with the issue with a patched version of the file. Luckily that solves the issue and doesn't require you to recompile your game. Still, there will be 1000s of games that don't get this update. If we're lucky some of the sites will just do this automatically for their users.

But BTW, users are still uploading new games even today (Feb 2021) that have this bug as they are using older versions of Unity. Maybe some sites could check and warn the user?

It's been best practice for over a decade to NOT look at userAgent

This MDN article spells out why you shouldn't be looking at userAgent. You should instead be doing feature detection.

Unfortunately reality doesn't always meet expectations. Many web APIs have quirks that can not be easily detected. I didn't dig through the Unity code to see if what they were checking for was a "it can't be helped" kind of issue or a "we didn't know we could feature detect this" issue, but do know I personally have run into these kinds of issues and I also know, sometimes I could try to feature detect but it would be a PITA, meaning checking "If Safari, fall back to X" might take 2 lines of code where as checking that whatever browser I'm using actually follows the spec might take 50 lines of code and I'm lazy ๐Ÿ˜…

The userAgent is going away

Or at least in theory all the browser vendors have suggested they plan to get rid of the userAgent string or freeze it. Here's Chrome plans.

It's not clear what they are replacing it with is all that much better. It's better in that it needs less parsing? It sounds like it still provides all the same info to hang yourself with and to be tracked.

But, in some ways, it does possibly let Unity off the hook. AFAIK Chrome may decide to change their version string claiming MacOS 10 even on MacOS 11. Safari and Firefox already do this, I'm guessing for similar reasons, too many poorly coded sites broken. You might think Safari and Firefox don't report MacOS 11 because of tracking but if preventing tracking was their goal they wouldn't report the version of the browser in the userAgent, which they do.

Sometimes I want the userAgent

I recently wanted to write some software to check how many users can use feature X and I wanted to do it by checking which OS and which browser they are on so I can see for example, 70% of users on Safari, Mac can use feature X and 60% of users on Chrome, Android can use the same feature.

That seems like a reasonable thing to want to know so as much as I don't like being tracked I'm also not sure getting rid of the data available via userAgent is the best thing. It doesn't appear that data is going away though, just changing.


I wrote "Unity broke the internet" mostly because Unity's many years old bug, spread over thousands of sites, potentially forced the browsers to work around those sites rather than progress forward. Unfortunately it's not the first time that's happened

Apparently the same thing happened to Firefox and they ended up adjusting their userAgent string. That rabbit hole lead me to this horror fest! ๐Ÿ˜ฑ

Zip - How not to design a file format.
Done Answering Questions Stack Overflow