Admob, Can't call a function from HandleUserEarnedReward() for some reason

Apologies if Admob related things aren’t allowed here, feel free to remove if not.
It’s just Google products like this don’t have any decent support for questions.

public void HandleUserEarnedReward(object sender, Reward args)
     {
         string type = args.Type;
         double amount = args.Amount;
         MonoBehaviour.print(
             "HandleRewardedAdRewarded event received for "
                         + amount.ToString() + " " + type);
         if(someBool)
         {
             save.something ++; //WORKS
             StopTimer(); //DON'T WORK
             ui.somethingElse(); //DON'T WORK
             someBool = false; //WORKS
         }
     }

Just Want to make sure I’m not missing something obvious, I won’t post the full script here as likely if anyone has the answer to this it’s if they’ve used Admob themselves.

And to clarify testing this on Android, The AD shows, the reward is given(Variable changes work) but the functions are not called from the rewardHandler. I can provide any more info if you have questions to help me solve.
And the references for the script calls are set up and working correctly.

How are you debugging? And show your actual code please. https://discussions.unity.com/t/748729/14 Debug.Log output will also show in the Android logcat logs.

Look i get this issue and i fixit, in HandleUserEarnedReward i don’t know why you can’t put fun or some call but i fix it via
Make bool in HandleUserEarnedReward if Earned make it true and put this bool in update function and make it false when come inside if in update

EX :
bool IsEarned = false;
HandleUserEarnedReward()
{
IsEarned = true ;
}

Update ()
{
if (IsEarned)
// do something
IsEarned = false
}

Note the HandleUserEarnedReward it is call just one time that is mean the code inside update function is work one time
you can use print() to make your sure is work one time .

2 Likes