- 
  StackOverflow 文件
- 
  unity3d 教程
- 
  廣告整合
- 
  JavaScript 中的 Unity Ads 基礎知識
#pragma strict
import UnityEngine.Advertisements;
#if !UNITY_ADS // If the Ads service is not enabled
public var gameId : String; // Set this value from the inspector
public var enableTestMode : boolean = true; // Enable this during development
#endif
function InitializeAds () // Example of how to initialize the Unity Ads service
{
    #if !UNITY_ADS // If the Ads service is not enabled
    if (Advertisement.isSupported) { // If runtime platform is supported
        Advertisement.Initialize(gameId, enableTestMode); // Initialize
    }
    #endif
}
function ShowAd () // Example of how to show an ad
{
    if (Advertisement.isInitialized && Advertisement.IsReady()) { // If the ads are ready to be shown
        Advertisement.Show(); // Show the default ad placement
    }
}