Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Hacker237 · Jul 20, 2021 at 11:39 AM · erroriosnullreferenceexceptionadmob

NullReferenceException at at GoogleMobileAds.Api.MobileAds.Initialize (System.Action`1[T] initCompleteAction) [0x00000] in <00000000000000000000000000000000>:0

Hello. There is a problem with google AdMob. Test ads are shown in the editor (There are no errors in the editor), but real ads are not showing on my phone. Then I decided to use USB debugging and found out that the following error occurs:

"NullReferenceException: Object reference not set to an instance of an object. at GoogleMobileAds.Api.MobileAds.Initialize (System.Action`1[T] initCompleteAction) [0x00000] in :0 at Show_ads.Start () [0x00000] in :0"

Here's my script:

using GoogleMobileAds.Api; using System.Collections; using System; using UnityEngine.Scripting; [assembly: Preserve]

public class Show_ads : MonoBehaviour { //ADS---------------------------- private RewardedAd rewardedAd; private const string RewardedID = "id"; //ADS----------------------------

 void Start()
 {
     MobileAds.Initialize(initStatus => { });
     LoadRewardedAD();
 }

 private void LoadRewardedAD()
 {
     //load-ad
     rewardedAd = new RewardedAd(RewardedID);
     AdRequest adRequest = new AdRequest.Builder().Build();
     rewardedAd.LoadAd(adRequest);

     rewardedAd.OnUserEarnedReward += HandleUserEarnedReward;
  }
  //Called from another script
 public void ShowRewardedAD()
 {
     if (rewardedAd.IsLoaded())
     {
         rewardedAd.Show();
     }
 }
 public void HandleUserEarnedReward(object sender, Reward args)
 {
     if (Reward_type == 0)
     {
   //gem
     }
     else if (Reward_type == 1)
     {
         //coin

     }
     else if (Reward_type == 2)
     {
         //Respawn

     }
 }

 private IEnumerator WaitAD()
 {
     yield return new WaitForSeconds(3);
     LoadRewardedAD();
 }

}

Who can help?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Tuanlak91 · Sep 06, 2021 at 09:15 AM

Hello Hacker237 did you fix this error? I also got the same error.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image erikp93 · Jan 03 at 12:37 AM 0
Share

@Tuanlak91 hi, did you perhaps manage to solve this ? I am having the same problem :/

avatar image
0

Answer by erikp93 · Jan 03 at 12:37 AM

hi Hacker237, did you manage to solve this issue ? if so, how did you do it ?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Hacker237 · Jan 07 at 10:03 AM

No I have not solve this error yet. I just dont use Admob anymore. I asked a lot about this problem but nobody can help me.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

196 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

AdMob iOS and Android 1 Answer

'GADAdmobExtras.h' file not found 0 Answers

Working .pod with admob and googleplayservice for ios 0 Answers

iOS (8) - sporadic microphone.start failure. 0 Answers

ios xcode 8 build error with google adbmob, GADMAdapterAdColony, ld: symbol(s) not found for architecture arm64 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges