Search Unity

Unity How should I install Unity Ads in my game: Asset Store Package, Package Manager or Services Window?

Discussion in 'Unity Ads' started by ap-unity, Jun 21, 2019.

Thread Status:
Not open for further replies.
  1. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,259
    There are two supported ways to install the Unity Ads:
    1. Download the Unity Monetization package from the Asset Store.
    2. Enable the Ads service via the Services Window. For newer versions of Unity, this will enable the Ads SDK from the Package Manager. For older versions of Unity, this will enable the Ads SDK that was included when the Editor was released.
    You can choose whichever you prefer, but you only need to do one.

    If you do both, you will run into compiler or build errors because the Ads SDK is duplicated in your project.


    The specific errors will vary by Unity version, but in general it will come in two forms:
    1. Compiler errors immediately when adding the duplicate SDK.
    2. Errors during build time. For Android, this may appear as com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives

    Asset Store package
    https://assetstore.unity.com/packages/add-ons/services/unity-monetization-3-1-0-66123

    This is likely the more straightforward approach. You can download and import the Ads SDK just like any other package.

    Note: If you are using an older version of the Asset Store, you may need to search for "Unity Monetization" instead of "Unity Ads". The next version of the Asset Store should resolve this issue.

    The Asset Store may provide a different version of the Ads package, depending on your version of the Editor.
    • If you are using Unity 4.6 to 5.0.0, then version Unity Ads 2.3.0 will be installed
    • If you are using Unity 5.0.1 to 5.6.5, then version Unity Ads 3.0.0 will be installed
    • If you are using Unity 5.6.6 or greater, then you will use the latest version available (currently 3.1.0)
    Note: Unfortunately, Advertisement.version isn't the most reliable way to get the version number for the Ads SDK. You can use something like Charles proxy to detect the actual version used in the calls to our Config server.


    Using Unity Ads in conjunction with other Unity Services

    If you are using another Service, such as Unity IAP or Unity Analytics, then there are a couple of things to keep in mind. Take the following scenario for example:
    1. You create a project on the Operate dashboard. This will generate the Game IDs you will need to initialize the Ads SDK.
    2. You create a project in the Unity Editor.
    3. You download the Ads package from the Asset Store.
    4. You create a project in the Services Window and enable Unity Analytics and Unity IAP. (You don't enable Unity Ads because this would result in duplication errors.)
    The problem here is two projects are now created for a single game. Data for Ads metrics will go to a different dashboard than Analytics & IAP data. The solution is simple enough: In Step 4, in the Services Window, instead of creating a new project, link to an existing project and find the project that you created in Step 1.

    Services Window

    Despite the multiple warnings in this post, it is possible to use the Services Window and Asset Store package in the same project, but you must tell Unity to ignore the built-in ads package and use the SDK from the Asset Store. This can be done under the Advanced settings in the Ads section of the Services Window. You have to uncheck the box that says “Enable built-in Ads extension”.

    Why would you need to do this? In the past, it was the only way to use the Services Window integration and keep up with the latest changes in the Asset Store package. This was important because, as I mentioned, the version of the SDK used by the Services Window was the one included with the Editor. That is the main problem Package Manager is meant to solve. If you are using a modern version of Unity (2018.1+), then there probably isn't any reason to use this setup in a new project.

    Package Manager

    The Package Manager was technically added in 2017.2, but the UI was added in 2018.1, so I suspect that's when most people would interact with it. As I mentioned above, the goal is to decouple components from the Editor release cycle.

    And it pretty much works as expected. If you have Ads installed in PackMan, you can switch on the Ads service in the Services Window and it works. In 2019.2, enabling the Ads service in the Services Window will automatically trigger the Ads package to be installed, so it is still a one button integration.

    Note: You do sometimes have to turn the flip the switch twice. I don't know why; it just happens. We're looking into it.


    Support

    If you have questions about integrating our SDK, I would recommend taking a look at our documentation:
    https://unityads.unity3d.com/help/monetization/getting-started

    If you ever run into any issues, please reach out to our Support team:
    dashboard.PNG

    unityads-support@unity3d.com
    .


    Here are some details you can provide that will help us understand your issue a bit more:
    • The specific Game ID for your project
    • Are you building your game with Unity, XCode, or Android Studio?
    • If Unity, which version are you using?
    • Which version of the Ads SDK are you using?
    • The code you are using to integrate Unity Ads
    • A device log from your app when Unity Ads is initialized
    • If you are using meditation, which version of the mediation SDK and adapter are you using?
     
    Last edited: Jun 26, 2019
Thread Status:
Not open for further replies.