Programming Guidelines

First of all, make sure, that you have finished all the core Ultimate Ads setup and all the advertising networks settings are provided and ready to go. Here we will discuss the programming pipeline of advertising with Ultimate Ads plugin.

There are following types available with Ultimate Ads - banners, interstitials, video and rewarded video advertisements. All these units will be discussed below.

Banner Ads

Super-easy super-simple programming implementation of banner advertising in your project is available for you with Ultimate Ads API. For now, the only one banner ads provider available - Google AdMob. The list of banner ads providers will be extended in future. Just two lines of code and you are ready to go! Please, check the example code snippet below

SA.UltimateAds.Banners.Init ();
SA.UltimateAds.Banners.Show ();

The logic is following - first of all, please, make sure that you made an Init method call at the very first start of your application. The base controller on the start scene of your app will be the best place for it. And finally, call Show method wherever you want.

One more API available for you with SA.UltimateAds.Banners class is Destroy method. When you don't want/don't need the banner view on the scene, please, destroy it as shown below.

SA.UltimateAds.Banners.Destroy ();

Important: Only one banner instance allowed on the screen at one time. If you want to refresh the banner, please, call Destroy and then Show method right after it.

Interstitial Ads

For now, the available interstitial ads providers are Google AdMob and Chartboost. The list of banner ads providers will be extended in future.

You have to initialize the interstitial advertising at first. Please, make sure, that you made the Init method call at the very first start of your application. The base controller on the start scene of your app will be the best place for it. Please, check the code snippet provided below.

SA.UltimateAds.Interstitial.Init ();

The interstitial ads will start to load automatically after the Init method call. The common approach is to check whether the interstitial ads has been loaded or not in the place you want to show the advertising. Ultimate Ads Interstitial controller will go through all the available interstitial providers and return the status for you.

If the interstitial advertising is ready, you have to subscribe to OnClosed event and call Show method where you need to show the advertising. The interstitial OnClosed event will be fired when the user will close the advertising view. Please, check the code snippet provided below.

if (SA.UltimateAds.Interstitial.IsReady ()) {
	SA.UltimateAds.Interstitial.OnClosed += InterstitialClosed;
	SA.UltimateAds.Interstitial.Show();
}

private void InterstitialClosed () {
	Debug.Log ("Interstitial Closed");
    SA.UltimateAds.Interstitial.OnClosed -= InterstitialClosed;
}

Important: Ultimate Ads testing is available in Unity Editor mode to simulate the behaviour you will get in your game. Check it out, this feature will save you a huge amount of time. If you have any comments/suggestions, please, feel free to contact our support team via support@stansassets.com

Video Ads

For now, the available interstitial ads providers are AdColony, Unity Ads and Vungle. The list of banner ads providers will be extended in future.

You have to initialize the video advertising at first. Please, make sure, that you made the Init method call at the very first start of your application. The base controller on the start scene of your app will be the best place for it.

SA.UltimateAds.Video.Init ();

The video ads will start to load automatically after the Init method call. The common approach is to check whether the video ads has been loaded or not in the place you want to show the advertising. Ultimate Ads Video controller will go through all the available video providers and return the status for you.

If the video advertising is ready, you have to subscribe to OnFinished event and call Show method where you need to show the advertising. The video OnFinished event will be fired when the user will close the advertising view. The bool success parameter will indicate whether the advertising was skipped by the user (success = false) or not (success = true). Please, check the code snippet provided below.

if (SA.UltimateAds.Video.IsVideoReady()) {
	SA.UltimateAds.Video.OnFinished += VideoFinished;
	SA.UltimateAds.Video.Show ();
}

private void VideoFinished (bool success) {
	Debug.Log ("Video Finished " + success);
	SA.UltimateAds.Video.OnFinished -= VideoFinished;
}

 

Important: Ultimate Ads testing is available in Unity Editor mode to simulate the behaviour you will get in your game. Check it out, this feature will save you a huge amount of time. If you have any comments/suggestions, please, feel free to contact our support team via support@stansassets.com

Rewarded Video Ads

For now, the available interstitial ads providers are AdColony, Unity Ads, Google AdMob and Chartboost. The list of banner ads providers will be extended in future.

You have to initialize the rewarded video advertising at first. Please, make sure, that you made the Init method call at the very first start of your application. The base controller on the start scene of your app will be the best place for it.

SA.UltimateAds.RewardedVideo.Init ();

The rewarded video ads will start to load automatically after the Init method call. The common approach is to check whether the rewarded video ads has been loaded or not in the place you want to show the advertising. Ultimate Ads Rewarded Video controller will go through all the available rewarded video providers and return the status for you.

If the rewarded video advertising is ready, you have to subscribe to OnRewarded event and call Show method where you need to show the advertising. The video OnRewarded event will be fired when the user will close the advertising view. There are three parameters in OnRewarded event described below:

  • bool success - parameter will indicate whether the advertising was skipped by the user (success = false) or not (success = true). Please, check the code snippet provided below.
  • string item - reward item name (or type).
  • int amount - the amount of reward. E.g. (100 Coins, 1 Gem

Please, check the code snippet provided below.

if (SA.UltimateAds.RewardedVideo.IsReady()) {
	SA.UltimateAds.RewardedVideo.OnRewarded += Rewarded;
	SA.UltimateAds.RewardedVideo.Show();
}

private void Rewarded (bool success, string item, int amount) {
	Debug.Log ("User Rewarded " + success + " " + item + " " + amount);
    SA.UltimateAds.RewardedVideo.OnRewarded -= Rewarded;
}

Important: Ultimate Ads testing is available in Unity Editor mode to simulate the behaviour you will get in your game. Check it out, this feature will save you a huge amount of time. If you have any comments/suggestions, please, feel free to contact our support team via support@stansassets.com