Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[Solved] SDK 3.0 initializer error

Discussion in 'Unity Ads' started by MrDasix, Dec 30, 2018.

Thread Status:
Not open for further replies.
  1. MrDasix

    MrDasix

    Joined:
    Feb 15, 2015
    Posts:
    53
    IN the unity editor thee ads work fine, but when i execute the app on android i allways get this error on the logcat
    com.unity3d.services.core.api.Sdk.logError() (line:57) :: {}
    .

    I'm in unity 2018.2.18 and using unity ads sdk 3.0.

    I use this code to initialize the ads:
    Code (CSharp):
    1.     string gameId = "XXXXXXX";
    2.     bool testMode = false;
    3.  
    4.     void Start()
    5.     {
    6.         Monetization.Initialize(gameId, testMode);
    7.     }
    And this one to call the ads:
    Code (CSharp):
    1. [HideInInspector] public string whyIsRewarded;
    2.  
    3.     public void ShowRewardedAd(string why)
    4.     {
    5.         whyIsRewarded = why;
    6.         StartCoroutine(WaitForAd());
    7.     }
    8.  
    9.     IEnumerator WaitForAd()
    10.     {
    11.         while (!Monetization.IsReady("rewardedVideo"))
    12.         {
    13.             yield return null;
    14.         }
    15.  
    16.         ShowAdPlacementContent ad = null;
    17.         ad = Monetization.GetPlacementContent("rewardedVideo") as ShowAdPlacementContent;
    18.  
    19.         if (ad != null)
    20.         {
    21.             ad.Show(AdFinished);
    22.         }
    23.     }
    24.  
    25.     void AdFinished(ShowResult result)
    26.     {
    27.         if (result == ShowResult.Finished)
    28.         {
    29.             if (whyIsRewarded == "Continue")
    30.             {
    31.                 GameObject.Find("protected").SendMessage("Continue");
    32.             }
    33.             else if (whyIsRewarded == "Shop")
    34.             {
    35.                 GameObject.Find("CargarGuardar").SendMessage("AugmentCoins", Random.Range(10, 50));
    36.             }
    37.         }
    38.         else
    39.         {
    40.             if (whyIsRewarded == "Continue")
    41.             {
    42.                 GameObject.Find("protected").SendMessage("NoContinue");
    43.             }
    44.             else if (whyIsRewarded == "Shop")
    45.             {
    46.                 Debug.Log("error");
    47.             }
    48.         }
    49.     }
    What i'm doing wrong?
    How can i solve this?

    Thank you.
    Dasix
     
    Last edited: Dec 30, 2018
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,130
    What line is causing the error? Use Debug.Log to determine. Does your app still work, regardless of the message in the log?
     
  3. MrDasix

    MrDasix

    Joined:
    Feb 15, 2015
    Posts:
    53
    Sorry it was my error, The game Id was wrong. Not it works perfect :eek:k_hand:
     
Thread Status:
Not open for further replies.