Skip to main content

Optimisation - Overview

One of the main goals of Luna is to provide a flexible yet simple tool for optimising the size of HTML5 builds. Luna employs many techniques ranging from utilizing web-friendly formats of the assets to sophisticated repacking of data to cut down the download size, speed up startup time and runtime performance.

The above becomes especially critical in Playable Ad setting, as the majority of networks limit the size of the playable (i.e. to 5Mb) along with prohibiting network communication, which cuts off the possibility to download any additional data on the fly. In addition to that, Playable Ads have to start fast - otherwise the impression might be discarded leading to poor overall performance.

Finally, when building in Unity, you must be aware that the final product will be running in the web environment, which is inherently performance constrained. Implementations that work well in Unity, may not perform as well in a browser. Therefore it is important to be performance-conscious when building and optimising your playable experience.

Later in this section, we have provided some practical tips for optimising startup time and runtime performance.

We are also releasing a series of articles on Size Optimization on Medium, the first of which you can find by clicking here.

Playable size: Where to start

First of all, developers should never fall for judging the build size by inspecting the development build: it is not designed for production use of any sort as it lacks asset compression, serves each file individually and is meant purely for testing purposes on a local machine.

A good starting point would be to upload the build to Luna Create Hub and clicking "Download" button next to default version:


Clicking it will open a popup with all available network options and will hint which ones don't meet size requirements:


If you see any red signs in the popup or simply want to optimise your playable size, a good starting point would be to start with inspecting size breakdown in Luna UI.

Preloader Images

Preloader images are never compressed in the Luna export process.

If your playable has extra sizing that is seemingly unaccounted for, it could be your preloader images.

Why we don't compress them

Preloader images are the first assets shown to the user whilst your playable loads. This means the images need to be raw in order to avoid unwanted decompression and read time. As such preloader images are put into the index.html file without any compression.

On the up side this reduces load times, however the file's original size will be the same in the playable as it is in Unity. This can increase your playable's size dramatically depending on the image(s).

How to reduce the size of Preloader Images

In order to reduce your preloader image file sizes, you will need to manually reduce their original size before exporting them with the Luna plugin.

To do so you can use a raster graphics editor (like Microsoft Paint or Adobe Photoshop) and scale the image down, or change the image format to a more lossy type (e.g. PNG32 -> PNG8, as Preloaders don't usually need an alpha value).

Reducing your preloader images can in turn cut your playable's total size dramatically, keep this in mind if you're looking to save space anywhere you can!