This document describes how to set annotations, fidelity parameters, and quality
levels in your Unity project.

## Annotations

Annotations give contextual information about what your game is doing when a
tick is recorded.

### Default annotations

The plugin defines one default annotation for you:

- ***Scene***: Contains the identifier of the current scene being played; useful in cases where most of your levels map to a single scene in your project

To see these annotations in UI, do the following:

1. Select **Google \> Android Performance Tuner**.
2. Select the **Annotation parameters** tab and then click **Use custom
   parameters**.

   ![](https://developer.android.com/static/images/games/performance-tuner/unity-apt-annotation-parameters.png)
   **Figure 1.** **Annotation parameters** tab in the plugin

## Define and use a custom annotation

To create a custom annotation, do the following:

1. On the **Annotation parameters** tab, click the **+** button to create a new annotation.
2. In the new row, click on the **Type** column and select **Add or update
   enum**. As an example, you can make an enumeration for the game difficulty.

   | **Note:** Use CamelCase (with an initial capital) for enum type names and CAPITALS_WITH_UNDERSCORES for the enum values.
3. Click the **Add New Enum** button after specifying the enum values.

   ![](https://developer.android.com/static/images/games/performance-tuner/unity-apt-add-enum.png)
   **Figure 2.** Add a new enum
4. Select the new type in the **Type** column. Enter a name for the parameter
   in the **Parameter name** column.

   ![](https://developer.android.com/static/images/games/performance-tuner/unity-apt-add-enum2.png)
   **Figure 3.** Select the new enum
5. Click the **Apply** button to let the plugin regenerate the protocol buffer
   files and classes.

To set this annotation in your game, call
[`SetCurrentAnnotation()`](https://developer.android.com/games/sdk/reference/performance-tuner/unity/class/google/android/performance-tuner/android-performance-tuner-t-fidelity-t-annotation-#setcurrentannotation):  

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

## Define fidelity parameters and quality levels

Fidelity parameters reflect the performance and graphical settings of your game.
Quality levels are used to annotate sessions so that you can determine if
devices are running on a quality level that is too high (resulting in lower
performance) or too low (resulting in unnecessarily reduced fidelity).

Your game might already have different fidelity parameters such as the
following:

- Shadow quality
- Texture resolution
- Particle effects quality

These parameters can be regrouped into quality levels (for example "low",
"medium", and "high"). To have these parameters properly reported by
Android Performance Tuner, and then analyzed and visualized in the
Google Play Console, you must expose the parameters to the plugin. Add your
fidelity parameters in the **Fidelity parameters** tab.

![](https://developer.android.com/static/images/games/performance-tuner/unity-apt-fidelity-parameters.png)
**Figure 4.** **Fidelity parameters** tab in the plugin

Select **Use custom parameters**, and then define a set of parameters. Each
parameter has a type, like annotations.

Use the
[`SetFidelityParameters()`](https://developer.android.com/games/sdk/reference/performance-tuner/unity/class/google/android/performance-tuner/android-performance-tuner-t-fidelity-t-annotation-#setfidelityparameters)
function to set the fidelity parameters as appropriate in your game:  

    tuner.SetFidelityParameters(new FidelityParams
    {
        ParticleDetails = 1.0f,
        ShadowQuality = ShadowQuality.High,
        TextureResolution = 2048,
    });

Next, define different quality levels that will be used to group the data in the
Google Play Console and give you better insights. Add your quality levels in
the **Quality levels** tab.

Click the **Add Level** button to add your first level. Define multiple levels
that follow a trend. For example, define levels for the lowest quality level to
the highest.

![](https://developer.android.com/static/images/games/performance-tuner/unity-apt-quality-levels.png)
**Figure 5.** **Quality levels** tab in the plugin