Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by looMeenin · Jan 26, 2015 at 11:21 PM · adslagadvertisingunity4.6

why is my game lagging when using Unity Ads?

When my game starts the welcome screen has quite a few animations that play out. It was working fine until I implemented Unity Ads into my game. Now there is a noticeable lag when this bit of code executes:

Advertisement.Initialize ();.

It only lasts for a second but it is quite nasty. I tried putting the code in a co-routine and calling after the bulk of the heavy animations are completed but it still causes a considerable disruption to the remaining simple animations that are looping.

I'm thinking about putting it inside of my "Earn Button" onClick event but then the user will have to wait for the ads to load up which can take up to 5 seconds in my experience.

Is there a way I can call this code while the splash screen is loading?

I am testing on a Samsung S5 if that helps.

Comment
Add comment · Show 1
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 AGEITA94 · Mar 28, 2017 at 01:15 AM 0
Share

I am having the same problem, did you get any solution?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by mtdrume · Feb 17, 2015 at 12:30 PM

I use a second splash screen for my game. It simply waits to be informed that the Ads component has been initialized then loads the level/game. Only issue is that if no active internet, game will never load. But this link: http://answers.unity3d.com/questions/567497/how-to-100-check-internet-availability.html#answer-567499 covers how to check for an internet connection. Hope it helps :)

 using UnityEngine;
 using UnityEngine.Advertisements;
 using System.Collections;
 
 public class DestroyLogo : MonoBehaviour {
 
     void Start ()
     {
         // initialize adverts
         if (Advertisement.isSupported) {
             Advertisement.allowPrecache = true;
             Advertisement.Initialize ("131625064");
         } else {
             Debug.Log("Platform not supported");
         }
         // end initialize 
     }
     
     void Update()
     {
     // see if its done.
     if (Advertisement.isInitialized)
         {
         Application.LoadLevel ("level");
         }
     }
 }

  

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 Joe-Censored · Mar 28, 2017 at 01:24 AM 0
Share

It is still feasible that unity ads could fail to initialize for some reason besides internet connection. I'd just come up with a timeout value of maybe 10 seconds that is the max you would wait for it, and then go to the game when that passes.

Add to the top: private float timer = 0f;

In your update:

 void Update()
 {
     timer += Time.deltaTime;
     if (Advertisement.isInitialized || timer >= 10.0f)
     {
         Application.LoadLevel("level");
     }
 {






avatar image AGEITA94 Joe-Censored · Mar 28, 2017 at 02:07 AM 0
Share

@Joe-Censored is this worked with you? if yes, could you show me how you initialized your ads?

thanks you

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

22 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

Related Questions

admob reward ad shows after clicking several times (problem) 1 Answer

My unity ads aren't showing "real" ads. 2 Answers

Does Google/Apple/Someone else take a cut off the ad revenue on my products? 0 Answers

How to check if a test ad is ready 0 Answers

Getting error on using Adduplex ads in Windows Phone 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