Best Way to Host Unity WebGL Games in a Production Environment Using AWS

Hosting your game in the cloud is an integral step towards gathering player feedback and releasing it into the wild. However, getting everything up and running may be daunting task – in this article, we’ll outline how best to host Unity WebGL Games using AWS in a production environment.

Unity creates a folder containing static files that are hosted on an S3 bucket and are accessible by anyone with Internet connectivity, making the game playable on any browser that supports WebGL without needing additional plugins to run smoothly.

You can set the parameters of your WebGL build when opening the Player Settings window under File > Project Settings > Player. Simply select WebGL and click Switch Platform to customize its platform settings.

Select a compression format and decompression fallback in the WebGL Build Settings window of Unity to embed a JavaScript decompressor for decompression if your browser fails to decompress (recommended). Compression formats available are: gzip and Brotli (more info below).

Enabling decompression fallback in your build files increases loader size and requires extra knowledge about server configuration. To allow browsers to perform decompression themselves while downloading your app, add a Content-Encoding header that matches up with what type of compression was used at build time.