This page describes how to configure Android Performance Tuner to include
Addressables scenes in Unity.

[Addressables](https://docs.unity3d.com/Packages/com.unity.addressables@0.8/manual/index.html)
allow developers to dynamically load content at runtime.
This can include scenes that are not present in Unity's build settings when
the .apk is built.
Before Android Performance Tuner 1.5.1, those scenes were not recognised by
Android Performance Tuner and couldn't be inspected in the Play Console.

## Requirements

Support for Addressables scenes has the following requirements:

- Android Performance Tuner 1.5.1 or later
- Unity 2019.3 or later
- Addressables package 1.19.4 or later

## Add Addressables scenes

To make Android Performance Tuner recognise your Addressables scenes,
do the following:

1. When you're ready to test your app, go to
   **Window \> Android Performance Tuner \> Setup** and open the
   **Addressables Settings** tab.

   ![](https://developer.android.com/static/images/games/performance-tuner/unity-apt-addr-window.png)
   **Figure 1.** Addressables Settings window.
2. Click the **Update Addressables Scenes** button.

By default, all the scenes contained in the
`AddressableAssetSettingsDefaultObject` are included in
Android Performance Tuner.
The window now displays a list of all the scenes that were found coupled with
their value as saved in the proto file.

![](https://developer.android.com/static/images/games/performance-tuner/unity-apt-addr-scenes.png)
**Figure 2.** Addressables scenes listed by Android Performance Tuner.

To change the Addressable Settings Object from which scenes are pulled:

1. Go to the **Assets/AndroidPerformanceTuner_gen/Runtime/Resources** folder
   and open the **SetupConfig** scriptable object in the Inspector.

2. Insert the path to your custom Settings Object in the
   **Addressables Settings Object Path** field, including the name of the file.

We recommend that you update the Addressables scenes when your scenes layout is
semi-final to avoid backward compatibility issues.

Android Performance Tuner only collects data for scenes that were present
in the .apk file that was uploaded to the Play Console.

## Resetting Addressables scenes

You can reset your Addressables scenes by clicking
**Reset Addressables Scenes** in the **Addressables Settings** tab.
However, this breaks compatibility with the currently-published version of
the app.

Dynamically updating the `SetupConfig` object in the app without publishing
a new release will result in errors in the Play Console as the scene-value
relations won't be preserved.

## Setting Addressables scenes in annotations

If you're using default annotations, Android Performance Tuner automatically sets
the correct scene.
If you're using custom annotations,
call `ConvertAddressableScenePathToAPTSceneIndex()`:  

    tuner.SetCurrentAnnotation(new Annotation
    {
        Scene = (Scene) tuner.ConvertAddressableScenePathToAPTSceneIndex(scenePath),
        Difficulty = Difficulty.Medium
    });