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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Reward ad not calling the functions. Why?

Discussion in 'Getting Started' started by Dex_Tran01, Jun 23, 2020.

?

Reward ad not calling the functions

  1. Reward Ad

    1 vote(s)
    100.0%
  2. AdMob

    1 vote(s)
    100.0%
Multiple votes are allowed.
  1. Dex_Tran01

    Dex_Tran01

    Joined:
    Jan 27, 2016
    Posts:
    2
    Im using Unity and ı want add reward ad in my app. The ad showing when ı click the button but after the ad end, it must be called some function but it doesnt. Example it make coin += 4 but coin doesnt change. Please help me. I cant see the problem. There is no any error. These are my codes : 2020-06-23_18-39-24.png
     
  2. Dex_Tran01

    Dex_Tran01

    Joined:
    Jan 27, 2016
    Posts:
    2
    I solve the problem. I tell the solutuion. Create 2 boolean variable(Ex: rewarded, adClosed) and create 2 methot for these.
    Method1(object sender, EventArgs args) {
    adClosed = true;
    }
    Method2(object sender, EventArgs args){
    rewarded = true;
    }
    then, into the void start write these:
    OnAdClosed += method1
    OnAdRewarded += method2

    and next, into the void update write these
    if(adclose== true){
    // Event when ad closed...
    adclose = false;
    }
    if(rewarded == true){
    // Events when ad finish. Ex : coin += 10...
    rewarded = false;
    }
    thats it. Sorry for my bad england.