This issue was originally reported against macOS Beta in Bug? Generated UnityLoader.js fails in iOS 14 public beta , where it was noticed that pre-release Safari in macOS beta channel was unable to run Unity WebGL builds.
A symptom of this issue was an error box at page startup, that prints
Uncaught TypeError: Cannot read property ‘1’ of null
or the progress bar hangs at 0%, and observing the web page console prints the same error.
Back then, patches were deployed to all Unity release channels like Emily mentions, though when it came time to release, it looks like Apple actually froze Safari’s user agent to an earlier version, sidestepping the problem altogether, hence the fixes were not needed after all for Safari.
The root cause of the issue was an old piece of system information identification script in Unity that was not robustly future proof to major OS version number changes. I.e. it is not a bug in Safari, or in Chrome.
In the past year, there has been intent for browser vendors to “freeze and mask” navigator user agent strings in time, deprecating navigator.userAgent to avoid increasing fingerprinting possibilities on the web. See
- Chrome Platform Status
- https://groups.google.com/a/chromium.org/g/blink-dev/c/-2JIRNMWJ7s/m/yHe4tQNLCgAJ
- Prepare for Client Hints, freezing User Agent | by Daybrush (Younkue Choi) | NAVER FE Platform | Medium
- 1609304 - Reduce Gecko's User-Agent strings
It looks like Apple had done just that with the macOS Big Sur release. Firefox has the UA string also frozen for Big Sur. Chrome has a tracking bug for the same here: https://bugs.chromium.org/p/chromium/issues/detail?id=955620 .
What caught us by surprise was that the same issue that Unity had with the pre-release version of Safari Beta channel, also now unsurfaced in Chrome 88 Stable release. Now we are (quite painfully so) aware that older already deployed Unity games are unable to run on this Chrome version.
Here is what to do:
A. First, if you are an author of a Unity game, you can resolve the issue by updating and rebuilding your Unity project using one of:
- 2018.4.31f1 or newer,
- 2019.4.16f1 or newer,
- 2020.1.15f1 or newer,
- 2020.2.0f1 or newer,
- 2021.1.0a2 or newer.
This is the preferred and cleanest fix.
B. However, if you have a project that is for some reason unable to update to a newer Unity editor version, you do not have the source project any more, or if you are a maintainer of existing built content (a website admin, a portal author, etc.), and cannot rebuild the project(s), we have created a hotfix script that can be used to patch already produced Unity game builds. You can find the script attached in this post.
Copy the script to the same directory as the build, and run python patch_unity_big_sur_build.py to patch. Or run python patch_unity_big_sur_build.py --help for detailed instructions. You can use the script to mass patch a whole directory tree.
C. If you just want to run your favorite Unity game that is affected by this bug in Chrome on macOS Big Sur, and the author has not yet provided an updated game build, you can adjust the user agent header posted by Chrome by following the instructions at How to Change User-Agents in Chrome, Edge, Safari & Firefox . Using one of the offered user agent strings, e.g. for “Chrome - Mac”, should work. Also clearing out the field by replacing it with a single space bar or period character will avoid the issue.
Hopefully one of these methods should unblock you to be able to resume work and play. We are terribly sorry for the trouble, please let us know if further issues persist. Especially if there are any blockers or regressions that would prevent from updating projects to one of the newer Unity versions.