Measure and Optmise Startup Time

It is important to measure and optimise the startup time of your playable ads, as this can directly impact user experience.

Measuring startup time

If you want to measure startup time accurately, it is recommended to follow these instructions and test the playable on a range of devices.

  1. Upload your build to Luna Playground.
  2. Download an Applovin version of the playable ad.
  3. Open the downloaded .html file in an IDE of your choice.
  4. Enter the following script at the begining of the <head> element:
<script>
var instantiateTime = Date.now();
function LogTime() {
var engineInitializedTime = Date.now();
alert("Loading time: " + (engineInitializedTime - instantiateTime) + " ms");
}
</script>
  1. In the <body> section of the HTML file, find the StartWithJSCallback function, and add LogTime(). For example:
.StarWithJSCallback( function() {
//Add function here
LogTime();
...
...
...
})
  1. You may now test this HTML file on a device to measure the startup time. You will see the following:
images-xsmall


Optimising startup time

By optimising the startup time of your Unity scene, you will also improve the start up time of your playable.

  1. We recommend that you start by optimising by using the inbuilt Profiler in Unity.
  2. You may also use Chrome Dev Tools for more advanced optimisation.

Here are some common techinques which may help you achieve a lower startup time.

  • Smaller playables typically have shorter startup times - check out the guide for optimising assets
  • Avoid using GetComponent calls unless absolutely necessary
  • Remove/reduce heavy Awake/Start methods
  • Avoid using particles sytems with high amounts of particles (Unity has 1000 by default, whereas 50-100 is typically suitable for a playable ad)
  • Keep your project hierarchy tidy - avoid unecessary use of multipe child objects
  • Use ShaderVariantCollections with as few shaders as possible
  • Disable 'Auto-Instantiate prefabs' and avoid logic which retrieves prefab data
  • Never use FindObjectOfType in update/fixed update
  • If your scene requires a large number of static objects, then consider baking them
  • Avoid using TMP_Text autosize if possible