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 graviton · Jul 07, 2016 at 05:01 PM · initializationinternetunityads

Can't connect to unityAds, if internet connection is gained after game has started

I'm using unityAds, and I ran into a an issue with Ad initialization.

If the game is started with no internet connection, it fails to initialize Ads. This makes sense, however Ads never initialize, even if an internet connection is gained at some point during the game, unless the whole game is restarted with an internet connection.

I'm using Unity 5.1.2f1, and the fixes in Unity 5.3 don't help me

So, any solutions?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by TofuS · Oct 12, 2016 at 06:03 AM

Did you find a fix to this? I'm having same problem

Comment
Add comment · Show 2 · 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 graviton · Oct 13, 2016 at 08:29 PM 0
Share

which Unity version are you using? (if you are not posting an answer, you should comment not reply)

avatar image TofuS · Oct 17, 2016 at 04:38 AM 0
Share

I was using Unity version 5.3.4 This would happen if the game started without any wifi or data, then later on if the user turned on their wifi or data, Unity ads would not initialise. Now i just updated my Unity to 5.3.6 Thanks for the reply!

avatar image
0

Answer by graviton · Oct 17, 2016 at 09:59 PM

You'll need UnityAdsHelper (I had to change some things in the scripts to make it work with my version of Unity; if I'm remembering correctly).

You should be fine, with your version.

Get UnityAdsHelper here

https://github.com/Applifier/unity-ads-helper/wiki

Extra help here

https://forum.unity3d.com/threads/ad-is-not-shown-after-enable-internet-connection.398626/#post-2603483

https://forum.unity3d.com/threads/ad-not-ready-and-data-connection.381577/#post-2480019

https://forum.unity3d.com/threads/cannot-disable-unityads-auto-initialization.402451/

found this example script

 using UnityEngine;
 using System.Collections;
 
 public class InternetConnectionCheckExample : MonoBehaviour 
 {
     
     private bool unityAdsInitialized = false;//can be used for informing the user about the status
 
 
     // Use this for initialization
     void Awake () 
     {
         StartCoroutine("checkInternetConnection");
     }
     
     public IEnumerator checkInternetConnection()
     {
         float timeCheck = 2.0f;//will check google.com every two seconds
         float t1;
         float t2;
         while(!unityAdsInitialized)
         {
             WWW www = new WWW("http://google.com");
             t1 = Time.fixedTime;
             yield return www;
             if (www.error == null)//if no error
             {
                 #if UNITY_ANDROID
                 //Advertisement.Initialize(androidGameID); // initialize Unity Ads.
                 UnityAdsHelper.Initialize(); // initialize Unity Ads.
                 #elif UNITY_IOS
                 UnityAdsHelper.Initialize(); // initialize Unity Ads.
                 #endif
                 
                 unityAdsInitialized = true;
                 
                 break;//will end the coroutine
             }
             t2 = Time.fixedTime - t1;
             if(t2 < timeCheck)
                 yield return new WaitForSeconds(timeCheck - t2);
         }
     } 
 }
 








Comment
Add comment · 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

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

45 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

Related Questions

Initialising List array for use in a custom Editor 1 Answer

Finding a gameobject in a level that has not been loaded 1 Answer

vector2D Array initialization not working. 3 Answers

Init code goes to Null unknow reason 2 Answers

Attempting to change AnimatorController during Runtime 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