|
| 1 | +--- |
| 2 | +title: Add the Plugin |
| 3 | +sidebar_label: Unity |
| 4 | +--- |
| 5 | + |
| 6 | +First step is always to add the plugin to your development environment. |
| 7 | + |
| 8 | + |
| 9 | +## Asset Store |
| 10 | + |
| 11 | +Open the Asset Store in your browser and add the plugin to your assets. |
| 12 | + |
| 13 | +Open the Package Manager (Window > Package Manager) in the Unity Editor and select the "My Assets" section. Select the plugin, and click Import in the bottom right. |
| 14 | + |
| 15 | + |
| 16 | +## Manual Installation |
| 17 | + |
| 18 | +In unity you import the package by selecting `Assets / Import Package / Custom Package ...` and then browsing to the unity plugin package file: `com.distriqt.Display.unitypackage`. |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +You can manually download the extension from our repository: |
| 23 | + |
| 24 | +- https://github.com/distriqt/ANE-Display |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +## Import the Plugin |
| 29 | + |
| 30 | + |
| 31 | +This will present the import dialog and display all the files for the plugin, make sure all the files are selected. |
| 32 | + |
| 33 | +The plugin will be added to your project and you can now use the plugins functionality in your application. |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +## Resolve Android Dependencies |
| 39 | + |
| 40 | +This plugin depends on some common Android libraries, particularly the Google Play Core Library, which enables in-app reviews. |
| 41 | + |
| 42 | +You can get these dependencies using one of the following methods. |
| 43 | + |
| 44 | + |
| 45 | +### Unity Jar Resolver |
| 46 | + |
| 47 | +This is the suggested method. |
| 48 | + |
| 49 | +Use the *Unity Jar Resolver* plugin to download and manage the Android dependencies. |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +#### Importing |
| 54 | + |
| 55 | +> If you already use the *Unity Jar Resolver* in your project you can skip this step. |
| 56 | +
|
| 57 | +- Download the latest version of the [*Unity Jar Resolver*](https://github.com/googlesamples/unity-jar-resolver/releases) |
| 58 | +- Import the plugin by selecting `Assets / Import Package / Custom Package ...` and locate the plugin you downloaded. The plugin will be in the zip named: `external-dependency-manager-latest.unitypackage` |
| 59 | +- In the *Import Unity Package* window, click Import |
| 60 | + |
| 61 | + |
| 62 | +#### Resolving |
| 63 | + |
| 64 | +By default, the resolver should run automatically and will add the dependencies required by this plugin. |
| 65 | + |
| 66 | +If you have need to resolve the dependencies manually then you will need to: |
| 67 | + |
| 68 | +- Open the menu under: `Assets / External Dependency Manager / Android Resolver` |
| 69 | +- Select `Resolve` or `Force Resolve` |
| 70 | + |
| 71 | + |
| 72 | +More information on the *Unity Jar Resolver* can be found [here](https://github.com/googlesamples/unity-jar-resolver) |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +### Custom Gradle Display |
| 77 | + |
| 78 | +Unity's in-built gradle build support and exporting to android studio does not support per plugin gradle script. Therefore, this plugin cannot add the dependencies by itself. |
| 79 | + |
| 80 | +The `mainDisplay.gradle` is generated when you enable the **Custom Gradle Display** property on the Player window. |
| 81 | + |
| 82 | +The `build.gradle` exists in generated Gradle project when you enable the **Export Project** property on the Player window and Build the project. |
| 83 | + |
| 84 | +Update the `dependencies` section in your `mainDisplay.gradle` or `build.gradle` as below: |
| 85 | + |
| 86 | +``` |
| 87 | +dependencies { |
| 88 | + compile fileTree(dir: 'libs', include: ['*.jar']) |
| 89 | + |
| 90 | + implementation 'com.google.android.play:core:1.9.1' |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | + |
| 95 | +## Checking for Support |
| 96 | + |
| 97 | +You can use the `isSupported` flag to determine if this extension is supported on the current platform and device. |
| 98 | + |
| 99 | +This allows you to react to whether the functionality is available on the device and provide an alternative solution if not. |
| 100 | + |
| 101 | + |
| 102 | +```csharp |
| 103 | +if (Display.isSupported) |
| 104 | +{ |
| 105 | + // Functionality here |
| 106 | +} |
| 107 | +``` |
0 commit comments