Googleads-mobile-unity: AppIDs dissapearing when changing code after implementing #1695

Created on 7 Oct 2021  路  4Comments  路  Source: googleads/googleads-mobile-unity

Step 0: Are you in the right place?

  • For general technical questions, or help with project-specific issues like setting up ads in
    your app, reach out to our support team on the
    Developer Forum.
  • For assistance with your AdMob account, reach out to
    AdMob Support.
  • For feedback on our documentation,
    send your feedback by pressing the Send Feedback button at the top right of the
    documentation page you are on.
  • For issues related to __the code in this repository__, continue filing this GitHub issue.

  • Once you've read this section and determined that your issue is appropriate for
    this repository, please delete this section.

[REQUIRED] Step 1: Describe your environment

  • Unity version: 2020.3.15f2
  • Google Mobile Ads Unity plugin version: 6.1.1
  • Platform: Unity Editor (iOS, Android, Unity Editor)
  • Platform OS version: Windows 10 (eg iOS 10, Android 9)
  • Any specific devices issue occurs on: _____
  • Mediation ad networks used, and their versions: _____

[REQUIRED] Step 2: Describe the problem

Apop IDs dissapear when tabbing back to unity after making a change.
This appears to be the same as #1692 and #1694
Opening a new issue since I have applied the fix in #1695 and the issue appears to be related but not identical.

Steps to reproduce:

  1. Install the plugin
  2. Apply the fix in #1695
  3. Change any code in visual studio.

Relevant Code:

// TODO(you): code here to reproduce the problem
P2

Most helpful comment

To fix this, try adding another null check after line 59 in the above code, like this:

         instance = Resources.Load<GoogleMobileAdsSettings>(MobileAdsSettingsFile); 

         if (instance != null) 
         { 
             return instance; 
         } 

All 4 comments

Thanks, I will review.

Yep, that fix worked before new release with new bad code in GoogleMobileAdsSettings script.
This part of code written without testing for sure. They loading the file from the Resources and then creating a new instance.
https://github.com/googleads/googleads-mobile-unity/blob/ebd375f124375d3133e7195a80208c15c7981f21/source/plugin/Assets/GoogleMobileAds/Editor/GoogleMobileAdsSettings.cs#L50-L72

To fix this, try adding another null check after line 59 in the above code, like this:

         instance = Resources.Load<GoogleMobileAdsSettings>(MobileAdsSettingsFile); 

         if (instance != null) 
         { 
             return instance; 
         } 

This issue is resolved in the latest plugin version "Google Mobile Ads Unity Plugin v6.1.2".

Was this page helpful?
0 / 5 - 0 ratings