# Install and Set Up the Unity Plugin

How to install the Airship Unity plugin.

## Requirements

* Unity 5+
* iOS: Xcode `15.3&#43;`
* iOS: Minimum deployment target iOS `15&#43;`
* Android: Android SDK installed and updated (requires `minSdkVersion` = `23&#43;`)
* Android: Using Android SDK manager, install API `36&#43;`. 
  * If a Custom Gradle Template is used, the gradle template needs to be configured to use API VERSION `36&#43;`.


## Setup

[Download](https://github.com/urbanairship/ua-unity-plugin/releases) the latest plugin
and import the `unitypackage` into the Unity project: `Open Assets -> Import Package -> Custom Package`.

![Install and Set Up the Unity Plugin](https://www.airship.com/docs/images/unity-assets-import-package_hu_a6880ed7081154dc.webp)

Configure Airship Settings: `Open Window -> Airship -> Settings` and set the Airship settings.

> **Important:** Leave the `Android FCM Sender ID` field **BLANK** for both Production and Development.


> **Important:** If your app uses Airship's EU cloud site, you will need to configure that using the `Cloud Site` setting.


![Install and Set Up the Unity Plugin](https://www.airship.com/docs/images/unity-ua-settings_hu_94e022e909756bec.webp)
![Install and Set Up the Unity Plugin](https://www.airship.com/docs/images/unity-ua-config_hu_1800978d81e08caf.webp)

If proguard is enabled, add Airship settings to the `proguard-user.txt` file:

`-keep public class com.urbanairship.unityplugin.UnityPlugin
-keepclassmembers class com.urbanairship.unityplugin.UnityPlugin {
  public <methods>;
  public <fields>;
  static <methods>;
}`

For push notification setup, see the [Push Notifications Getting Started guide](https://www.airship.com/docs/developer/sdk-integration/unity/push-notifications/getting-started/).

## Troubleshooting

A common error when setting up our Unity plugin is "Could not create an instance of type org.gradle.initialization.DefaultSettings_Decorated". If you encounter this error, take these steps in the Unity Editor:

1. Go to **Assets**, then **External Dependency Manager**, then **Android Resolver**, then **Force Resolve**.

1. Sometimes Unity has difficulty retrieving the JDK installed with your editor even when selected. To solve this:
   1. Go to **Edit**, then **Preferences**, then **External Tools**.
   1. For **JDK**, select **Copy Path**, uncheck **JDK Installed with Unity (Recommended)**, then paste the path.

   ![Setting the JDK path in the Unity Editor](https://www.airship.com/docs/images/unity/unity-uncheck-jdk-installed_hu_9c5a35b94f3157d2.webp)
   
   *Setting the JDK path in the Unity Editor*

1. ![Enabling project templates in the Unity Editor](https://www.airship.com/docs/images/unity/unity-enable-custom-gradle_hu_7a1ebe2c4fc15bd9.webp)

*Enabling project templates in the Unity Editor*

If the previous steps do not fix your issue:
   
   1. Go to **Project Settings**, then **Player**, then **Android**, then **Publishing Settings**, then **Build**, and then select **Custom Main Gradle Template** and **Custom Gradle Properties Template**.
   
   1. Go to **Assets**, then **External Dependency Manager**, then **Android Resolver**, then **Force Resolve**.

If you don't see a channel ID or encounter errors during initialization, see [Troubleshooting Initialization](https://www.airship.com/docs/developer/sdk-integration/unity/troubleshooting/initialization/) for common problems and solutions.
