Hi all,
My application consist of one scene with an option of user to refresh the screen i simply call LoadScene again. I want to show ad on every 5th loading, it works fine on refresh screen . However it never works on a new app start up. It works on unity but it doesnt work on my android. Here is my code, any help would be great.
void Start () {
Debug.Log (PlayerPrefs.GetInt ("ADNumber"));
Advertisement.Initialize ("xxxxx", true);
Invoke ("showAd", 1f);
}
// Update is called once per frame
public void showAd(){
AdCounter=PlayerPrefs.GetInt("ADNumber");
AdCounter++;
if ((AdCounter / 5) * 5 == AdCounter) { // or AdCounter %5==0 doesnt matter
Advertisement.Show ();
}
PlayerPrefs.SetInt ("ADNumber", AdCounter);
}
The problem is splash screen i think. When I called the ads after 3 seconds it worked right after splash screen.
Somehow I need to check when the app is opening and Invoke the ad after 3 seconds,
and on refresh screen i will invoke the ad after 0.5 seconds. Because popping up the ad late after refresh is not very user friendly.
James thanks for your reply, but setting AdCounter to 0 on every start method would never show any ads., I am not calling showAd() method from anywhere else except the start of this script.