Hi I have added an ad for rewarded video when game is over if user completed it reload the scene.But every time it shows ad after game over even user watched ad already i want user can only watch ad once.
My code is :
bool canshowad = true;
public void ShowAd(string zone = "rewardedVideoZone ")
{
if (canshowad)
{
ShowOptions options = new ShowOptions();
options.resultCallback = AdCallbackhanler;
if (Advertisement.IsReady(zone))
{
Advertisement.Show(zone, options);
}
}
else
Debug.Log("No ads");
}
void AdCallbackhanler(ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
break;
case ShowResult.Skipped:
break;
case ShowResult.Failed:
break;
}
}
When i reload the scene canshowad become true and my condition override.Please help in this.Thanks in advance.
↧