How Can I Apply Ads Different Level?? I Create A 40 Level,
Ex:
- Level1 complete then load ads Interstitial
- Level2 complete then load ads Interstitial
- Level3 complete then load ads Rewarded
- Level4 complete then load ads Rewarded
- Level5 complete then load ads Interstitial
- Level6 complete then load ads Interstital
follow this same pattern in further levels(40)
Code:
public string currentscenename;
public string nextscenename;
public void Next() //code for next level
{
int num = PlayerPrefs.GetInt("Level", 0);
Debug.Log("Num1:" + num);
num++;
PlayerPrefs.SetInt("Level", num);
if (currentscenename == nextscenename)
{
Next();
Debug.Log("loadlevel");
}
else
{
if (num % 4 == 3 || num % 4 == 0) // it is working absolutely fine
{
//DebugPanel.Log("num1", "num2" + num % 4);
if (rewardBasedVideo.IsLoaded())
{
rewardBasedVideo.Show(); //this line generate reward ads
//DebugPanel.Log("rewarded", "rewardedads");
//DebugPanel.Log("inside ads" , "inside ads function");
Debug.Log("rewarded 1");
}
}
if(num % 4 == 2 || num % 4 == 1) //1 and 2
{
myclass.CallAds.Instance.AdsRequest(); //this line generate interstitial ads
DebugPanel.Log("num" , "num" + num % 4);
Debug.Log("interstitial 2");
}
SceneManager.LoadScene(nextscenename);
}
}
**Maths:** problem is here my condition will not be run when coming Level5 and Level10,Level15,Level20,Level25,Level30,Level35,Level40
5 mod 4 = 1
10 mod 4 = 2
Problem is when coming Level5 and Level10 then not showning ads????plz help
I m Using Google AdmobAds: https://developers.google.com/admob/unity/start
Referance:
