Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by davididev2 · Jun 06, 2016 at 02:15 PM · androidads

AdColony-- works on testing but not on published

I created my first game using AdColony recently. The ads showed up during test mode (as a placeholder) but when I published the game-- and set it to real ads-- they didn't show up at all.

My code: private const string ANDROID_VERSION = "version:1.2,store:google"; private const string ZONE_ID = ""; private const string ANDROID_APP_ID = "";

     public void Initialize()
     {
         AdColony.OnVideoFinished = AdHandler;
         if (Application.platform == RuntimePlatform.Android)
             AdColony.Configure(ANDROID_VERSION, ANDROID_APP_ID, ZONE_ID);
         //if(Application.platform == RuntimePlatform.IPhonePlayer)
         //    AdColony.Configure(ANDROID_VERSION, ANDROID_APP_ID, ZONE_ID);
         Debug.Log("Todo: iOS implementation");
     }
     // Use this for initialization
     void Start () {
         
         if (instance != null)
         {
             //Don't make two of em!
             Destroy(this.gameObject);
             return;
         }
         else
         {
             instance = this;
             Object.DontDestroyOnLoad(this.gameObject);
             //StartCoroutine(StartAdSystem());
         }
 
     }
 
     /*
     IEnumerator StartAdSystem()
     {
         if (Advertisement.isSupported)
         { // If runtime platform is supported...
             Advertisement.Initialize(); // ...initialize.
         }
 
         while (!Advertisement.isInitialized || !Advertisement.IsReady())
         {
             yield return new WaitForSeconds(0.5f);
         }
         yield return null;
     }
     */
 
     /// <summary>
     /// Reset the ad prompts (should only be called by panels that show a prompt)
     /// </summary>
     public void DisableAllPrompts()
     {
         promptChargeGun.SetActive(false);
         promptKeepPlaying.SetActive(false);
         adFailedPanel.SetActive(false);
         
     }
 
     IEnumerator AdFailurePanel()
     {
         adFailedPanel.SetActive(true);
         yield return new WaitForSeconds(2f);
         adFailedPanel.SetActive(false);
         failureCallbackFunction();
 
     }
 
     /// <summary>
     /// Show the prompt to charge the gun  (returns false if it can't play)
     /// </summary>
     public bool ShowPromptGun()
     {
         if (!Application.isMobilePlatform)
             return false;
         //if (!Advertisement.IsReady(RewardedZoneId))
         //   return false;
         if (!AdColony.IsVideoAvailable(ZONE_ID))
             return false;
         DisableAllPrompts();
         promptChargeGun.SetActive(true);
         return true;
 
     }
 
     /// <summary>
     /// Show the prompt to watch an ad and continue playing (returns false if it can't play the ad)
     /// </summary>
     public bool ShowKeepPlaying()
     {
         if (!Application.isMobilePlatform)
             return false;
         //if (!Advertisement.IsReady(RewardedZoneId))
         //    return false;
         if (!AdColony.IsVideoAvailable(ZONE_ID))
             return false;
         DisableAllPrompts();
         successCallbackFunction = SparePlayer;
         failureCallbackFunction = ReturnToTitle;
         promptKeepPlaying.SetActive(true);
         adProcess = DEATH_PROCESS.WAITING_FOR_AD;
         return true;
     }
 
     /// <summary>
     /// Show the prompt to watch an ad to make the gun charge faster (returns false if you can't play the ad)
     /// </summary>
     /// <returns></returns>
     public bool ShowChargeGun()
     {
         if (!Application.isMobilePlatform)
             return false;
         //if (!Advertisement.IsReady(RewardedZoneId))
         //    return false;
         if (!AdColony.IsVideoAvailable(ZONE_ID))
             return false;
         DisableAllPrompts();
         successCallbackFunction = SparePlayer;
         failureCallbackFunction = ReturnToTitle;
         promptChargeGun.SetActive(true);
         adProcess = DEATH_PROCESS.WAITING_FOR_AD;
         return true;
     }
 
 
     /// <summary>
     /// The player chose to watch an ad to keep going
     /// </summary>
     public void RunSparePlayerAd()
     {
         PlayAd(SparePlayer, ReturnToTitle);
     }
 
     public void ReturnToTitle()
     {
         SceneManager.LoadScene("Title");
     }
 
     void SparePlayer()
     {
         PlayerController.instance.RevivePlayer();
         DisableAllPrompts();
     }
 
 
     public void RunChargeGunAd()
     {
         PlayAd(ChargeGun, DoNothing);
     }
 
     void ChargeGun()
     {
         GlobalVars.instance.chargeUpgrades++;
         DisableAllPrompts();
     }
 
     void DoNothing()
     {
 
     }
 
     private void ShowAdFailed()
     {
         DisableAllPrompts();
         adFailedPanel.SetActive(true);
         StartCoroutine(AdFailurePanel());
     }
 
     public delegate void ON_AD_OVER();
     public ON_AD_OVER successCallbackFunction;
     public ON_AD_OVER failureCallbackFunction;
 
 
 
     /// <summary>
     /// Play an ad and run a function if it works
     /// </summary>
     /// <param name="s">void to call if successful</param>
     /// <param name="f">void to call if failure</param>
     private void PlayAd(ON_AD_OVER s, ON_AD_OVER f)
     {
         successCallbackFunction = s;
         failureCallbackFunction = f;
 
         /*
         UnityEngine.Advertisements.ShowOptions options = new ShowOptions();
         options.resultCallback = AdHandler;
         Advertisement.Show(RewardedZoneId, options);
         */
         
         AdColony.ShowVideoAd(ZONE_ID);
 
         //StartCoroutine(WaitForAd());
     }
 
     void AdHandler(bool adWasShown)
     {
         switch (adWasShown)
         {
             case false:
                 ShowAdFailed();
                 break;
             case true:
                 successCallbackFunction();
                 break;
         }
     }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

84 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is Unity Ads generating revenues when Unity Analytics is disabled ? 0 Answers

Rewarded video takes 3+ clicks to load 0 Answers

Unity 5 error after importing APPLOVIN! (for android) 1 Answer

Problems with revenue after getting 5000+ impressions 0 Answers

why chartboost sdk is not integrating to unity? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges