googleads-mobile-unity icon indicating copy to clipboard operation
googleads-mobile-unity copied to clipboard

Impressions and clicks on native ads are not counted if there are two cameras on the scene

Open mana-break opened this issue 2 years ago • 6 comments

[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?

mana-break avatar Jun 22 '22 10:06 mana-break

@NVentimiglia This is a serious issue, is there any fix being worked on for the next update?

Nyankoo avatar Jul 04 '22 13:07 Nyankoo

@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.

NVentimiglia avatar Jul 08 '22 15:07 NVentimiglia

@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 avatar Jul 08 '22 20:07 NVentimiglia

@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?

Nyankoo avatar Jul 08 '22 20:07 Nyankoo

@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

mana-break avatar Jul 09 '22 09:07 mana-break

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!

Nyankoo avatar Jul 09 '22 17:07 Nyankoo

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!

kunny avatar Feb 06 '23 15:02 kunny