Immersive Ads Integration

SDK Version - 1.2.8 Last updated

Before Integration

  1. Make sure you are using Unity version 2019.4.0f1 or above
  1. The platform selected for your Unity project is based on the target device
  1. You have the Ad Mob app ID ready with you. Make sure AdMob Unity version is v7.4.0 or above
  1. You have a PubScale SDK App ID and a Native Ad Unit ID for the platform you are targeting (Android / iOS)
  1. Ensure your application builds without any errors BEFORE adding the plugin


Editor Integration Steps

  1. If using Unity editor version 2019 or 2020 change the Api Compatibility Level to .NET 4x.

This can be found under Player Settings/Other Settings/Configuration

  1. Download and import the latest version of the Google Mobile Ads plugin.
  1. Download and import the latest version of the PubScale Native Ads plugin.
  1. Enter your PubScale App ID in the PubScale editor window located under Window/PubScale SDK/Main
Android PubScale App ID
iOS PubScale App ID
  1. Force resolve the dependencies from Assets/External Dependency Manager/Android Resolver/Force Resolve if the resolver did not open automatically.
  1. Enter your AdMob app ID inside the editor window pop-up
    1. Go to Assets/Google Mobile Ads/Settings

    b. In the Google Mobile Ads Settings Inspector Window add your application ID.


Scene Setup

  1. Drag and drop the PubScaleManager prefab from Assets/PubscaleSDK/Common/Prefabs/PubScaleManager.prefab in the first scene in your Build Settings.
  1. Drag and drop any of the Native ad unit prefab from Assets/PubscaleSDK/NativeAds/Prefabs/AdHolderUnits into your gameplay scene. (Note: If using any prefab from the “ScreenSpaceCamera” folder then put it under any Canvas in Screen Space-Camera render mode to see ads on it.)
  1. Open the Settings Tab in the PubScale Main Menu found under Window/PubScale SDK/Main and Enter the Native Ads settings.
Android fallback ad unit
iOS fallback ad unit
  1. Make sure to add any of the Native Ad IDs in the Fallback AD ID field. This ensures ads are requested in case there is a network delay in receiving the dynamic ad config file from the server.
  1. To test the integration always Use Test Mode. (This will enable test ads and show a debug UI over the native ad for checking Ad Impressions and Clicks)
  1. Hit the play button in the editor and ensure PubScale dummy test ads are visible and there are no errors and warnings. Also please note that the impression and click don’t work inside Editor.
  1. Finally, To test Impressions and Clicks, build the application to an actual device. Check if you are able to see the impression indicator turning green when the ad comes inside the camera view and the click indicator turning green when you tap on the ad.
Please make sure you have the Android build gradle version 4 and above.

Your Integration is now complete! 🎉


More Samples💥

Take a look at our Samples project📁 for more exciting ways in which you can integrate native ads into your games!


Documentation📝

Please refer to this Scripting API for advanced integration.


Troubleshooting

Ad Loading Failed

  1. Make sure you have added the App ID inside the Google Ad Mob settings window.
  1. In the case of live ad id (Test mode off), this may happen if there is no fill from the Google server.

No Impression but Click

  1. If it’s a 3d game the camera and the ad unit must be on the side + Z world axis to get an impression.
  1. Make sure there is no collider between the main camera and the ad Unit.
  1. If you are instantiating ad prefabs in real-time try disabling the strip engine code option from the build option.

  1. If you have multiple camera’s on the scene make sure the camera which is looking toward the ad unit has the priority depth value.
  1. Make sure the Unity Event system component is present in the scene.

Impression but No Click

  1. Make sure there is no collider between the main camera and the ad Unit.
  1. Make sure the Unity Event system component is present in the scene.

Build Issues with Gradle

If you run into Gradle issues in Unity 2019 or 2020

  1. Check the Gradle version in the Unity Settings section and point the Gradle to 2021 unity version's Gradle file or above.
  1. Check if the Custom base Gradle Template is enabled from the Publishing settings option under project settings
  1. Change the gradle version inside the baseProjectTemplate.gradle (Found under Plugin > Android ) file to 4.0.0
  1. Check and uncheck the Android options inside the External Tools section of the Preferences only keep the Gradle option unchecked after changing the Gradle version for 2019 and 2020.
  1. Do a force resolve in the External Dependency Manager
  1. Check Minimum API Level and Target API Level under project settings>> Player section
  1. Check the API compatibility level to .Net 4x
  1. Check the device cable if it is connected when building the .apk to a device.