It is important to measure and optimise the startup time of your playable ads, as this can directly impact user experience.
Optimising startup time
By optimising the startup time of your Unity scene, you will also improve the start up time of your playable.
- We recommend that you start by optimising by using the inbuilt Profiler in Unity.
- You may also use Chrome Dev Tools for more advanced optimisation.
- Smaller playables typically have shorter startup times - check out the guide for optimising assets.
- If you’re storing prefabs of entire levels, it’s a good idea to remove any objects not seen in the playable, this helps to reduce initial load times. Also, remove any prefabs that aren’t going to be used in the playable.
Here are some common techniques which may help you achieve a lower startup time.
- Remove/reduce heavy
- Avoid using
FindObjectcalls which are slow and resource consuming, especially in update and fixed update methods only use them unless absolutely necessary.
Cacheyour references instead of dynamically finding them to avoid looking up objects as much as possible.
- Avoid unnecessary physics collisions in your scene use the
Physics Matrix- Edit > Project Settings, then select checkboxes to adjust the settings.
- Physics - avoid unnecessary use of components like
Continuous collision detection(CCD).
- Avoid using particles systems 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 unnecessary nesting of objects, avoid deep nests.
ShaderVariantCollectionswith as few shaders as possible.
Auto-Instantiate prefabsand avoid logic which retrieves prefab data.
- If your scene requires many static objects, then consider baking them.
- Avoid using too many objects in the scene, Luna doesn’t support batching yet. If you have a lot of objects that don’t move or move together, then bake them! (careful as this can increase size).
- Unity Text is which is more optimal during gameplay than
TMP_Text- use TMP for end cards, and Unity text for in game text.
- Avoid using
TMP_Textautosize if possible.
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.
- Upload your build to Luna Playground.
- Download an Applovin version of the playable ad.
- Open the downloaded
.htmlfile in an IDE of your choice.
- Enter the following script at the begining of the
- In the
<body>section of the HTML file, find the
StartWithJSCallbackfunction, and add
LogTime(). For example:
- You may now test this HTML file on a device to measure the startup time. You will see the following: