Skip to content

Unity iOS Advanced Usage

yanivav edited this page Jul 3, 2014 · 13 revisions

######This section describes advanced usage and personal customization options and is not mandatory for the integration.

##Selecting Interstitial Ad Type When calling an interstitial ad, the ad type with the best performance will be automatically selected. If you would like to explicitly choose the type of ad, use the "withType" parameter when calling loadAd.

The options for this parameter are:

Constant Name Description Specific Ad Load Example
STAAdType_Automatic (Recommended) Automatic selects the most suitable banner of the two listed below [startAppAd loadAd:STAAdType_Automatic ];
STAAdType_FullScreen A full-page ad [startAppAd loadAd:STAAdType_FullScreen ];
STAAdType_OfferWall A full page offerwall [startAppAd loadAd:STAAdType_OfferWall ];
STAAdType_Overlay An overlay Ad is a full page Ad that runs on top of your application [startAppAd loadAd:STAAdType_Overlay ];

We highly recommend using the Automatic type, which automatically selects the best ad type to display.

Back to top

##Adding Interstitial Callbacks

Use one of your GameObjects as a delegate to get callbacks from the interstitial ad. Even an empty GameObject you create for this purpose will do:

  1. Pass the GameObject name to the loadAd() method
void Start () {
        #if UNITY_IPHONE
        StartAppWrapperiOS.loadAd(StartAppWrapperiOS.AdType.STAAdType_Automatic,
                                  "GameObject Name");
        #endif    
}
  1. Implement the following callbacks in your GameObject script
public class StartAppGameObject : MonoBehaviour {
   // Use this for initialization
   void Start () {
       #if UNITY_IPHONE
       StartAppWrapperiOS.loadAd(StartAppWrapperiOS.AdType.STAAdType_Automatic,
                                 "GameObject name");
       #endif    
   }
   

  void didLoadAd() {
       #if UNITY_IPHONE
           Debug.Log("didLoadAd");
       #endif    
   }
   void failedLoadAd(string Error) {
      #if UNITY_IPHONE
           Debug.Log("failedLoadAd");
       #endif
   }
   void didShowAd() {
       #if UNITY_IPHONE
           Debug.Log("didShowAd");
       #endif    
   }
   void failedShowAd(string Error) {
       #if UNITY_IPHONE
           Debug.Log("failedShowAd");
       #endif    
   }
   void didCloseAd() {
       #if UNITY_IPHONE
           Debug.Log("didCloseAd");
       #endif    
   }
}

Back to top

Clone this wiki locally