This page describes how to download, import, and configure the Unity plugin for
Android Performance Tuner.

## Requirements

To use the plugin in your game, use a supported version of Unity:

- Unity version 2017.4 or later and [.NET version 4.6](https://dotnet.microsoft.com/download/dotnet-framework/net46)
- To use APK Expansion files, Unity 2018.2 is required
- For improved frame pacing and GPU measurements, Unity version 2019.3.14 or later is required
- For Addressables scenes support, Unity 2019.3 or later and [Addressables package 1.19.4](https://docs.unity3d.com/Packages/com.unity.addressables@0.8/manual/index.html) or later are required.

## Download the plugin

Download the plugin from the
[GitHub repository](https://github.com/android/tuningfork/releases). Select the
`.unitypackage` file download.

## Import the plugin

Before importing the plugin, make sure your project is using .NET version 4.6.
This applies to Unity version 2018.4 and earlier (later versions of Unity
contain .NET version 4.6 only).

1. Select **File \> Build Settings**. Make sure Android is selected as the current platform.
2. Click the **Player Settings** button.
3. Under **Other Settings** , find **Scripting Runtime Version** and select **.NET 4.6**.

The plugin is provided as a Unity Package that you can import in your project.
Select **Assets \> Import Package \> Custom Package** and select the
`.unitypackage` file you downloaded.

### Android Performance Tuner version **1.5.1 or higher** with **Unity 2017**

Using Android Performance Tuner version **1.5.1 or higher** with **Unity 2017**
requires the following additional steps when importing the plugin:

1. Go to the **Assets/AndroidPerformanceTuner/Editor** folder.
2. Click the **Google.Android.PerformanceTuner.Editor** file to open it in the **Inspector**.
3. Click the missing assembly reference and then click **-** to remove it.
4. Click the **Apply** button.

   ![](https://developer.android.com/static/images/games/performance-tuner/unity-apt-asmdef-missing-ref.png)
   **Figure 1.** Missing assembly reference.
5. Go to the **Assets/AndroidPerformanceTuner/Runtime** folder.

6. Click the **Google.Android.PerformanceTuner** file to open it in the
   Inspector.

7. Repeat **step 3** to remove the two missing assembly references.

8. Restart Unity.

9. Go to **Window \> AndroidPerformanceTuner \> Setup** and verify that no errors
   are displayed.

### Re-importing the plugin after deletion

If you're re-importing the plugin after removing it from the project, remove
`ANDROID_PERFORMANCE_TUNER_UTILITIES` from
**Player Settings \> Scripting Define Symbols** first.

## Configure the plugin

To configure the plugin, do the following:

1. For Unity version 2019.3.14 or later:

   - Enable the Android Frame Pacing library. Android Performance Tuner will use
     this library to measure the performance of your game, including more
     in-depth measures than what Unity alone reports.

     Select **File \> Build Settings** and click the **Player Settings** button.
     Under **Resolution and Presentation** , select the **Optimized Frame Pacing**
     checkbox.
   - Synchronize the frame rendering with vertical blanks.

     From the Player Settings, select the **Quality** tab and find the
     **VSync Count** menu. Use any selection (except **Don't Sync** ).
     Selections other than **Don't Sync** enable more precise measurements in
     conjunction with the Android Frame Pacing library.
2. (For versions of Unity prior to 2019) Set the build system to Gradle. Select
   **File \> Build Settings** . Find **Build System** and select **Gradle**.

3. Add the internet access permission. Under **Other Settings** , find
   **Internet Access** and select **Require**.

4. Enter your API key. Once the plugin is installed, you can enter it from the
   **Window \> Android Performance Tuner \> Setup** menu. On this dialog, select the
   **Settings** tab and enter the
   [API key from your Google Cloud project](https://developer.android.com/games/sdk/performance-tuner/unity/enable-api)
   into the **API key** field.

   | **Note:** If you don't enter your API key, Android Performance Tuner won't send your game performance data to the Google Play Console. Android Performance Tuner logs this error, and you can see the error using `adb logcat`. (You will run `adb logcat` in the next section to confirm the proper operation of Android Performance Tuner.)

   ![](https://developer.android.com/static/images/games/performance-tuner/unity-apt-settings.png)
   **Figure 2.** Settings tab in the plugin