uNITY DEVELOPER

tECHNICAL GAME DESIGNER

uNITY DEVELOPER

tECHNICAL GAME DESIGNER

Build compression & Google Cloud Storage

Unity Engine

Sep 9, 2025

Theo Garnon

GOOGLE CLOUD STORAGE

GCS is a service provided by Google that allows organizations to manage and publish data in the form of databases, buckets, and other formats. Access to these data sets can be managed very precisely and requires great care, especially when handling sensitive information.

The GCS bucket allows users to store and retrieve images, videos, music, and… static websites.

That’s the one we’re interested in.

UNITY WEBGL AND COMPRESSION

Unity allows developers to easily build projects for WebGL by exporting them in a simple and well-known format: it generates several data files along with an index.html containing the player that will load those data files.

You can simply take this build folder, upload it to a server (or a bucket), and access the index.html… assuming the project isn’t too large.

Depending on the size and build settings, Unity may decide to compress the data using one of the following formats:

  • Brotli – Mainly used for Release builds. It offers the best compression ratio but takes longer to build.

  • Gzip – Typically used for Development builds. It’s heavier than Brotli but faster to build.

  • No compression – Self-explanatory.

These compression formats come with certain requirements to ensure that all data is properly read. These requirements apply to both the client side (the browser) and the server side.

On the client side, Gzip is compatible with all browsers over HTTP & HTTPS, while Brotli is supported only over HTTPS and on more recent browsers.

On the server side, the server must know it’s sending compressed files so it can inform the client accordingly. Otherwise, browsers will try to read the compressed files as plain JavaScript.

gsutil setmeta -h "Content-Encoding:gzip" -h "Content-Type:application/javascript" gs://MY_BUCKET/Build/BUILD_NAME.framework.js.gz

gsutil setmeta -h "Content-Encoding:gzip" -h "Content-Type:application/wasm" gs://MY_BUCKET/Build/BUILD_NAME.wasm.gz

gsutil setmeta -h "Content-Encoding:gzip" -h "Content-Type:application/octet-stream" gs://MY_BUCKET/Build/BUILD_NAME.data.gz

These three CLI commands add metadata headers indicating that the data files are Gzip-compressed.

Contact:

Drop me a line

Want to work together? Have a question about an article? Feel resentment/hatred toward my person? If you think I can help you with anything drop me an email at tgarnon45@gmail.com or leave a message below and I'll get right back to you.

Contact:

Drop me a line

Want to work together? Have a question about an article? Feel resentment/hatred toward my person? If you think I can help you with anything drop me an email at tgarnon45@gmail.com or leave a message below and I'll get right back to you.

Contact:

Drop me a line

Want to work together? Have a question about an article? Feel resentment/hatred toward my person? If you think I can help you with anything drop me an email at tgarnon45@gmail.com or leave a message below and I'll get right back to you.

Theo Garnon

2025