Hi. Sorry for my bad english.
I few days ago installed new version Unity 2017.1.
Before i used 5.6.
I have a problem with integration ads in my project.
In old version unity, this code showed ads.
Now in new version unity, this code doesn’t work.
Error in console
Assets/UnityAdsExample.cs(15,45): error CS0246: The type or namespace name `ShowResult’ could not be found. Are you missing an assembly reference?
, and in code all method Advertisement showed error
“the name advertisement does not exist in the current context unity”
I installed from asset store . Unity ads.
Errors is gone. But code doesn’t work.
Advertisement.IsReady(“rewardedVideo”) send false
What’s wrong with my Unity?
Help me please!
using UnityEngine;
using UnityEngine.Advertisements;
public class UnityAdsExample : MonoBehaviour
{
public void ShowRewardedAd()
{
if (Advertisement.IsReady("rewardedVideo"))
{
var options = new ShowOptions { resultCallback = HandleShowResult };
Advertisement.Show("rewardedVideo", options);
}
}
private void HandleShowResult(ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
Debug.Log("The ad was successfully shown.");
//
// YOUR CODE TO REWARD THE GAMER
// Give coins etc.
break;
case ShowResult.Skipped:
Debug.Log("The ad was skipped before reaching the end.");
break;
case ShowResult.Failed:
Debug.LogError("The ad failed to be shown.");
break;
}
}
}