Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Solved] SDK 3.0 initializer error

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

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

    MrDasix

    Joined:
    Feb 15, 2015
    Posts:
    64
    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:
    14,446
    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:
    64
    Sorry it was my error, The game Id was wrong. Not it works perfect :eek:k_hand:
     
Thread Status:
Not open for further replies.