External Dependency Manager (EDM)
Recommended External Dependency Manager (EDM) Setup 🔗
The EDM can be downloaded as a tarball or legacy .unitypackage
from the following archive Google Unity APIs Archive. It is recommended to download the EDM as a tarball and integrate it through the package manager, as this will make sure future updates can be done without issues.
Since the EDM is meant to be a helper tool to sort out dependencies for Unity projects, it provides many approaches on how this can be done. By default, the EDM will download any available dependencies into your project’s Assets/Plugins/Android folder. Such approach is problematic since the more ad adapters you add, the more libraries and dependencies will be downloaded locally. As a result, your Android’s Plugin folder might become saturated with files.
In order to have the most flexibility and clean approach when utilizing the EDM. It is recommended to have at least the 2 following files into your project:
Both of the following files can be generated by visiting the Player Settings/Android/Publishing Settings/Build section of your Unity project.
-
Custom Main Template 🔗
(Assets/Plugins/Android/mainTemplate.gradle) By having this file the EDM will patch any dependencies into it so they can be fetched during compilation/build time. This is great to avoid having dependencies embedded directly into your codebase. However, this also means that any new libraries will be downloaded the first time you attempt to make a build.
-
Custom Gradle Properties Template 🔗
(Assets/Plugins/Android/gradleTemplate.properties) Gradle Properties Template allows us to specify aspects of how we want our Android project to be handled. This is useful for the EDM when dealing with legacy Android Support Library and Migrations to AndroidX libraries. Once the correct settings are setup, the file should look like this:
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M org.gradle.parallel=true # Android Resolver Properties Start android.useAndroidX=true android.enableJetifier=true # Android Resolver Properties End android.enableR8=**MINIFY_WITH_R_EIGHT** unityStreamingAssets=**STREAMING_ASSETS** **ADDITIONAL_PROPERTIES**
Recommended External Dependency Manager (EDM) Settings 🔗
Android 🔗
Right click on the Assets folder to see actions, then visit External Dependency Manager/Android Resolver/Settings
Make sure the following settings are setup as follows:
- Enable Auto Resolution
- Enable Resolution on Build
- Patch mainTemplate.gradle
- Use Jetifier
The settings above will make sure resolution of dependencies does not happen automatically when adding new ..Dependency.xml files or when trying to make a build. This is ideal since you will only want to resolve dependencies when you know new libraries with Mobile Native dependencies are being added into the Unity project.
Additionally, you can notice that if you leave auto resolution & resolution on build enable without following the recommended setup stated above, the libraries will get automatically downloaded into your Unity project every time a new ..Dependency.xml file is added or when a build is generated.
iOS 🔗
Right click on the Assets folder to see actions, then visit External Dependency Manager/iOS Resolver/Settings
Make sure the following settings are setup as follows:
- Pod File Generation
- CocoaPods Integration -> XCodeWorkspace add cocoapods to the XCode Workspace
- Auto install cocoapods in Editor
The default iOS setup should work right out of the box without issues. Please make sure that the settings above are correct. When exporting an XCode project from Unity, the EDM will generate a .xcdworkspace file and the standard .xcodeproj. Please make sure to always open the .xcdworkspace for proper compatibility with the downloaded and installed pods.
If you have any CI/CD processes in place that target the .xcodeproj to manage your XCode project, please change it to utilize the .xcdworkspace instead.
When pods resolution is successful, the EDM generates the .xcdworkspace and no errors are shown in the Unity Console. If errors appear, it’s generally related to a miss-matching pod dependency, this can be resolved by making sure all your dependencies are compatible with each other. (Make sure they are all up to date).
Pods can be found inside the XCode Workspace in an individual XCode Project called Pods.