Non rewarded Ads - StansAssets/com.stansassets.ultimate-mobile GitHub Wiki
First of all the ads has to be loaded before you can display it. See the code snippet below:
using SA.CrossPlatform.Advertisement;
...
//You can use any configured UM_AdPlatform here
//This example will use Unity ads, that's why we get client with UM_AdPlatform.Unity
UM_iAdsClient client = UM_AdvertisementService.GetClient(UM_AdPlatform.Unity);
client.NonRewardedAds.Load((result) => {
if (result.IsSucceeded) {
Debug.Log("NonRewardedAds loaded");
} else {
Debug.Log("Failed to load NonRewardedAds: " + result.Error.Message);
}
});
The load status can always be accessed via IsReady property.
bool ready = client.NonRewardedAds.IsReady;
Once ad content is loaded, you may show it:
m_adsClient.NonRewardedAds.Show(() => {
Debug.Log("Non Rewarded Ads closed");
});