Sunday, January 1, 2023

Unity WebGL tips / advice in 2023

I recently released a Unity WebGL game and the process was a bit painful. Here's what I learned...

In summary: 

  • I was using built-in pipeline and didn't try URP. (HDRP is definitely out of the question btw)
  • Unity WebGL support isn't bad, and WebGL performance is even OK, as long as you treat it like a ~2015 mobile device in terms of capability and performance. Don't throw a lot at it, especially because iOS browsers can't do a lot...
  • ... because it's 2023 and iOS WebGL performance is still pretty shitty even with Apple's promised ANGLE WebGL 2.0 support. You should expect to do a lot of mitigations and workarounds just so iPhones and iPads don't explode. Meanwhile, Windows and Android browsers are generally solid and reasonable. (In case you can't tell, I'm pretty annoyed with Apple.)
  • Here's what'll happen to you: your WebGL build tests on your desktop browser will work fine and you'll be pleasantly surprised... and then you'll try it on an iPhone and it'll be a mild disaster where you spend a week or two fixing all the various ways it explodes.

(Note: this is current as of Unity 2021.3.11 LTS + iOS 15.)