1

I get an error when I try to use:

 Ads.Configure(this.AppID, appOptions, this.zoneIDs);

The error says:

AdColony SDK unavailable on current platform

this is how I'm trying to play the ad:

public string AppID = "app53f882d220464f3399";
public string[] zoneIDs = new string[] { "vz53cbba96e85e4170b4", "vz53cbba96e85e4170b4" };

public void WatchADs()
{
    ConfigureAds();
    RegisterForAdsCallbacks();
  //  RegisterForAdsCallbacksReward();
    RequestAd();
    PlayAd();
    //RestartLevel();
}

void ConfigureAds()
{
    // AppOptions are optional
    AdColony.AppOptions appOptions = new AdColony.AppOptions();
    appOptions.UserId = "JackAlope";
    appOptions.TestModeEnabled = true;
    appOptions.AdOrientation = AdColony.AdOrientationType.AdColonyOrientationAll;
    if (Application.platform == RuntimePlatform.Android ||
    Application.platform == RuntimePlatform.IPhonePlayer)
    {
        Ads.Configure(this.AppID, appOptions, this.zoneIDs);
    }
}

void RegisterForAdsCallbacks()
{
    AdColony.Ads.OnRequestInterstitial += (AdColony.InterstitialAd ad) => {
        _ad = ad;
    };

    AdColony.Ads.OnExpiring += (AdColony.InterstitialAd ad) => {
        AdColony.Ads.RequestInterstitialAd(ad.ZoneId, null);
    };
}

void RequestAd()
{
    AdColony.AdOptions adOptions = new AdColony.AdOptions();
    adOptions.ShowPrePopup = true;
    adOptions.ShowPostPopup = true;
    if (Application.platform == RuntimePlatform.Android ||
    Application.platform == RuntimePlatform.IPhonePlayer)
    {
        AdColony.Ads.RequestInterstitialAd(zoneIDs[0], adOptions);
    }
}

void PlayAd()
{
    if (_ad != null)
    {
        AdColony.Ads.ShowAd(_ad);
    }
}
FalconCode
  • 11
  • 4

1 Answers1

2

Your current platform mode is likely one of the platforms the AdColony SDK don't support. AdColony SDK is supported on Android and iOS. Switch to Android or iOS from the Build Settings via the File ---> Build Settings menu or use code to to prevent on any platform that's not Android or iOS from calling Ads.Configure.

Do the check during run-time:

if (Application.platform == RuntimePlatform.Android ||
    Application.platform == RuntimePlatform.IPhonePlayer)
{
    Ads.Configure(this.AppID, appOptions, this.zoneIDs);
}

Or compile time:

#if UNITY_ANDROID || UNITY_IOS  
      Ads.Configure(this.AppID, appOptions, this.zoneIDs);
#endif
Programmer
  • 121,791
  • 22
  • 236
  • 328
  • I'am in android platform from player settings, now I don't get any error with this If condition, but it doesn't play the video. I did an apk, but nothing happens on my cellphone. I edit the question to show you how am I trying to play it. – FalconCode May 19 '18 at 06:33
  • 1
    My answer was only made to solve the original *"AdColony SDK unavailable on current platform"* in your question. You should create a new post for you add not showing issue – Programmer May 19 '18 at 06:39