googleads-mobile-unity
googleads-mobile-unity copied to clipboard
Impressions and clicks on native ads are not counted if there are two cameras on the scene
[REQUIRED] Step 1: Describe your environment
- Unity version: 2021.3.2
- Google Mobile Ads Unity plugin version: 7.1.0 + Native plugin
- Platform: android (iOS, Android, Unity Editor)
- Platform OS version: android 8.0.0 (eg iOS 10, Android 9)
- Any specific devices issue occurs on: _____
- Mediation ad networks used, and their versions: admob only
[REQUIRED] Step 2: Describe the problem
Briefly: Impressions and clicks on native ads are not counted if there are two cameras on the scene.
I have two cameras on scene. The main camera renders the game (it has the MainCamera tag), and the second camera is located outside the screen and renders additional icons. If there is only one camera on the scene, then native ads work well, but if there is a second camera, impressions and clicks are no longer registered for native ads. My assumption is that Admob is trying to recognize the presence of native ads through the secondary camera and therefore does not see it. How is the camera selected if there are several? Is the MainCamera tag used to select the main camera (it seems not) or some other logic? Is the camera selected when Admob is initialized, or every time native ad objects are registered?
@NVentimiglia This is a serious issue, is there any fix being worked on for the next update?
@Nyankoo Thanks for reaching out,
I see the issue but it is not something I can resolve quickly. We do have a fix planned, but it is not scheduled for this quarter.
Can you please submit a help center report . Include this github issue as well as your publisher id and ad unit id. This will help me escalate the issue.
@Nyankoo Below is our current camera lookup logic. Perhaps you can fix the problem by setting camera load order. This is called when the NativeAd is instantiated.
public static Camera GetCamera()
{
Camera[] cameras = new Camera[Camera.allCamerasCount];
Camera.GetAllCameras(cameras);
Camera activeCam = null;
foreach (Camera cam in cameras)
{
if (activeCam == null || cam.depth >= activeCam.depth)
{
activeCam = cam;
}
}
return activeCam;
}
```
@NVentimiglia Thank you for the hint! A quick Google search didn't bring anything up about camera load order. Do you have any insight on this?
@NVentimiglia Thank you for the hint! A quick Google search didn't bring anything up about camera load order. Do you have any insight on this?
Judging by the code above, you need to set the Depth field to the maximum value (relative to other cameras) in the editor for the main Сamera
Judging by the code above, you need to set the Depth field to the maximum value (relative to other cameras) in the editor for the main Сamera
Thank you, I will give this a try!
For those who're still experiencing the issue, please try upgrading the plugin version to 7.4.0 (and native plugin also), which should fix a few native ad issues. Thanks!