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 /
avatar image
0
Question by hhhdshsdfh · Sep 20, 2015 at 06:55 PM · adsunityads

unity ads only shows up to 8 ads in a row in my app

Hello, I have a problem with unity ads in my game. In my game I have a button that when clicked shows an ad and gives the user coins. For some reason the ads only work between 6-8 times in a row. And only begin to work again a few hours later. Here is the code for the button:

  using UnityEngine;
  using System.Collections;
  using UnityEngine.Advertisements;
  public class WatchUnityAd : MonoBehaviour
  {
      public int numOfCoinsToAdd = 5;
      bool paused = false,CRRuning = false;
      // Use this for initialization
      void Start()
      {
           //Advertisement.Initialize("66223",false);
      }
  
      public void ShowAd(string zone = "")
      {
  #if UNITY_EDITOR
          StartCoroutine(WaitForAd());
  #endif
          if (string.Equals(zone, ""))
              zone = null;
          /*while (!Advertisement.isInitialized)
          {
              Advertisement.Initialize("66223", false);
          }*/
          ShowOptions options = new ShowOptions();
          options.resultCallback = AdCallbackhandler;
  
          if (Advertisement.IsReady())
              Advertisement.Show(zone, options);
      }
  
      void AdCallbackhandler(ShowResult result)
      {
          switch (result)
          {
              case ShowResult.Finished:
                  Debug.Log("Ad Finished. Rewarding player...");
                  int coinTotal = PlayerPrefs.GetInt("coinTotal");
                  coinTotal += numOfCoinsToAdd;
                  PlayerPrefs.SetInt("coinTotal", coinTotal);
                  gameObject.SetActive(false);
                  break;
              case ShowResult.Skipped:
                  Debug.Log("Ad skipped. Son, I am dissapointed in you");
                  break;
              case ShowResult.Failed:
                  Debug.Log("I swear this has never happened to me before");
                  break;
          }
      }
  
      IEnumerator WaitForAd()
      {
          float currentTimeScale = Time.timeScale;
          Time.timeScale = 0f;
          yield return null;
  
          while (Advertisement.isShowing)
              yield return null;
  
          Time.timeScale = currentTimeScale;
      }
  }

I initialized the ads in a different script on startup. My game is already on the google play store and I wish to fix this problem as soon as possible. So if anyone has any idea for what is causing this please, I need your help. Thank you!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Gokusansan · Sep 20, 2015 at 08:30 PM

That is because UnityAds is capable of finding that many advertisements in a fixed time for one device. You can work with multiple advertisement providers like Admob or MobileCore for being able to watch more ads in a row.

Comment
Add comment · Show 1 · Share
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
avatar image hhhdshsdfh · Sep 21, 2015 at 04:43 AM 0
Share

Then, is there a way for me to know if unity can produce more ads, through program$$anonymous$$g, so that I could request an ad from a different company when that happens?

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Facebook network banner ads in unity - any documentation/tutorials? 1 Answer

No data for this time period, Ads 0 Answers

Unity Ads Problem on android 0 Answers

Error when building Game 0 Answers

Ad platform - Appodeal, good or bad? 1 Answer


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